December 11, 2011 05:14PM
Ситуация следующая:
1. есть сайт site.com расположенный по пути /www/site.com
2. есть движок, расположенный вне сайта. Скажем /www/core

Теперь необходимо, что бы при запросе site.com/cms/any.file.txt запрашивался файл /www/core/any.file.txt

На локальном компьютере это сделано следующим образом:
location ~ ^/cms {
alias /www/core/;
}
и это работает.

Но как только ставлю на сервер, то идентичная структура уже не роботает. Почему то получает редирект:

Connecting to site.com[XXX.XXX.XXX.XXX]:82... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://site.com:82/cms/license.txt/ [following]
--00:05:51-- http://site.com:82/cms/license.txt/
=> `index.html'
Connecting to site.com[XXX.XXX.XXX.XXX]:82... connected.
HTTP request sent, awaiting response... 403 Forbidden
00:05:51 ERROR 403: Forbidden.

В логах идет следующее:

2011/12/12 10:58:45 [debug] 25987#0: delete posted event 09EFEEE0
2011/12/12 10:58:45 [debug] 25987#0: accept on 0.0.0.0:82, ready: 0
2011/12/12 10:58:45 [debug] 25987#0: posix_memalign: 09EBCFF0:256 @16
2011/12/12 10:58:45 [debug] 25987#0: *18 accept: 78.56.111.111 fd:5
2011/12/12 10:58:45 [debug] 25987#0: *18 event timer add: 5: 60000:834058065
2011/12/12 10:58:45 [debug] 25987#0: *18 epoll add event: fd:5 op:1 ev:80000001
2011/12/12 10:58:45 [debug] 25987#0: *18 post event 09EFEF48
2011/12/12 10:58:45 [debug] 25987#0: *18 delete posted event 09EFEF48
2011/12/12 10:58:45 [debug] 25987#0: *18 malloc: 09EBED68:660
2011/12/12 10:58:45 [debug] 25987#0: *18 malloc: 09EBF000:1024
2011/12/12 10:58:45 [debug] 25987#0: *18 posix_memalign: 09EBF420:4096 @16
2011/12/12 10:58:45 [debug] 25987#0: *18 http process request line
2011/12/12 10:58:45 [debug] 25987#0: *18 recv: fd:5 119 of 1024
2011/12/12 10:58:45 [debug] 25987#0: *18 http request line: "GET /cms/license.txt HTTP/1.0"
2011/12/12 10:58:45 [debug] 25987#0: *18 http uri: "/cms/license.txt"
2011/12/12 10:58:45 [debug] 25987#0: *18 http args: ""
2011/12/12 10:58:45 [debug] 25987#0: *18 http exten: "txt"
2011/12/12 10:58:45 [debug] 25987#0: *18 http process request header line
2011/12/12 10:58:45 [debug] 25987#0: *18 http header: "User-Agent: Wget/1.8.2"
2011/12/12 10:58:45 [debug] 25987#0: *18 http header: "Host: site.com:82"
2011/12/12 10:58:45 [debug] 25987#0: *18 http header: "Accept: */*"
2011/12/12 10:58:45 [debug] 25987#0: *18 http header: "Connection: Keep-Alive"
2011/12/12 10:58:45 [debug] 25987#0: *18 http header done
2011/12/12 10:58:45 [debug] 25987#0: *18 event timer del: 5: 834058065
2011/12/12 10:58:45 [debug] 25987#0: *18 rewrite phase: 0
2011/12/12 10:58:45 [debug] 25987#0: *18 http script value: "/www/site.com/"
2011/12/12 10:58:45 [debug] 25987#0: *18 http script set $server_web_root
2011/12/12 10:58:45 [debug] 25987#0: *18 test location: ~ "^/cms"
2011/12/12 10:58:45 [debug] 25987#0: *18 using configuration "^/cms"
2011/12/12 10:58:45 [debug] 25987#0: *18 http cl:-1 max:1048576
2011/12/12 10:58:45 [debug] 25987#0: *18 rewrite phase: 2
2011/12/12 10:58:45 [debug] 25987#0: *18 post rewrite phase: 3
2011/12/12 10:58:45 [debug] 25987#0: *18 generic phase: 4
2011/12/12 10:58:45 [debug] 25987#0: *18 generic phase: 5
2011/12/12 10:58:45 [debug] 25987#0: *18 access phase: 6
2011/12/12 10:58:45 [debug] 25987#0: *18 access phase: 7
2011/12/12 10:58:45 [debug] 25987#0: *18 post access phase: 8
2011/12/12 10:58:45 [debug] 25987#0: *18 content phase: 9
2011/12/12 10:58:45 [debug] 25987#0: *18 content phase: 10
2011/12/12 10:58:45 [debug] 25987#0: *18 content phase: 11
2011/12/12 10:58:45 [debug] 25987#0: *18 http script copy: "/www/core/"
2011/12/12 10:58:45 [debug] 25987#0: *18 http filename: "/www/core/"
2011/12/12 10:58:45 [debug] 25987#0: *18 add cleanup: 09EBF998
2011/12/12 10:58:45 [debug] 25987#0: *18 http static fd: -1
2011/12/12 10:58:45 [debug] 25987#0: *18 http dir
2011/12/12 10:58:45 [debug] 25987#0: *18 http finalize request: 301, "/cms/license.txt?" a:1, c:1
2011/12/12 10:58:45 [debug] 25987#0: *18 http special response: 301, "/cms/license.txt?"
2011/12/12 10:58:45 [debug] 25987#0: *18 http set discard body
2011/12/12 10:58:45 [debug] 25987#0: *18 HTTP/1.1 301 Moved Permanently
Server: nginx/1.1.10
Date: Mon, 12 Dec 2011 09:58:45 GMT
Content-Type: text/html
Content-Length: 185
Location: http://site.com:82/cms/license.txt/
Connection: keep-alive
Subject Author Posted

alias создает редирект

VadimK December 11, 2011 05:14PM

Re: alias создает редирект

Alexandr Gomoliako December 11, 2011 05:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 109
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready