alexk
July 27, 2010, 2:38pm
#1
Hi all,
I have web server where nginx is using as proxy for PHP scripts and web
server for static files. I use the following configuration:
server {
listen 80;
server_name *******.com;
access_log /var/log/nginx/.com.access_log;
location ~
.(jpg|jpeg|gif|png|css|js|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)(?.+)?$
{
root /var/www/ .com/public/;
index index.html index.php;
expires max;
access_log off;
}
location ~ /.ht {
deny all;
}
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_set_header Host $host;
proxy_connect_timeout 60;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_redirect off;
proxy_set_header Connection close;
proxy_pass_header Content-Type;
proxy_pass_header Content-Disposition;
proxy_pass_header Content-Length;
}
}
Also there is apache2 running on port 8080 and process all non static
requests.
The problem in following - when I request
/en/all/all/filtered/246/1/date///-1//0 in logs of apache I see:
. .. ** - - [27/Jul/2010:12:33:48 +0000] “GET
/en/all/all/filtered/246/1/date/-1/0 HTTP/1.0” 200 11548 “-”
“Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8)
Gecko/20100722 Firefox/3.6.8 GTB7.1”
Please notice that there is no double slashes already. Apache gets
“/en/all/all/filtered/246/1/date/-1/0” instead of requested
“/en/all/all/filtered/246/1/date///-1//0”. And it creates problems in
the code.
And when I request Apache directly with
:8080/en/all/all/filtered/246/1/date///-1//0 it just works Ok. So I
suppose double slashes are missed somewhere in nginx.
I have nginx/0.7.67 installed.
Any ideas will be appreciated. Thanks!
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,113427,113427#msg-113427
alexk
July 27, 2010, 2:42pm
#2
On Tue, Jul 27, 2010 at 08:37:15AM -0400, alexk wrote:
.(jpg|jpeg|gif|png|css|js|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)(?.+)?$
proxy_pass http://127.0.0.1:8080/;
proxy_pass_header Content-Length;
/en/all/all/filtered/246/1/date/-1/0 HTTP/1.0" 200 11548 “-”
suppose double slashes are missed somewhere in nginx.
I have nginx/0.7.67 installed.
Any ideas will be appreciated. Thanks!
–
Igor S.
http://sysoev.ru/en/
alexk
July 27, 2010, 4:34pm
#3
Strange but it fixed the problem. Thanks a lot!
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,113427,113455#msg-113455
alexk
September 10, 2010, 2:06pm
#4
Strange,
When post is specified in listen directive:
server {
listen 80;
…
}
it works well with double slashes.
But when using domain name in listen directive
server {
listen *****.com;
…
}
it removes double slashes.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,113427,129135#msg-129135
alexk
September 10, 2010, 2:13pm
#5
Sorry vice versa
With domain name it works well. But when port is specified in listen it
removes double slashes.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,113427,129139#msg-129139
alexk
September 10, 2010, 2:17pm
#6
On Fri, Sep 10, 2010 at 08:05:13AM -0400, alexk wrote:
But when using domain name in listen directive
server {
listen *****.com;
…
}
it removes double slashes.
You probably proxy using
location / {
proxy_pass http://backend/;
}
You need ot remove the last “/”, then nginx will use a client original
request with double slashes:
location / {
proxy_pass http://backend;
}
–
Igor S.
http://sysoev.ru/en/
alexk
September 17, 2010, 1:03am
#7
Igor,
I’ve already replaced it to proxy_pass http://127.0.0.1:8080 ; after your
first post.
And now when I change it to:
server {
listen 80;
…
}
It removes double slashes.
With domain name it works just well.
Thanks,
Alex
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,113427,131146#msg-131146