Hi
I set up nginx (80) in front of apache (8080)
Everything runs fines as far as I access to main site (let's call it http://www.toto.com)
Problem begins when I try to access some subdirectories (for exemple http://www.toto.com/a_directory, that contains an index.php file)
This returns me different behaviour:
- Safari, Chrome & Opera : at first run, adress becomes "http://www.toto.com:8080/a_directory" and I get an error. I then remove the ":8080" and I have a correct access to my index.php file
- Firefox : an error telling that access to www.toto.com:8080 is appearing. I am forced to write the full adress (http://www.toto.com/a_directory/index.php) to be able to access to the page
How to avoid this behavior and make everything works fine & normally ?
/etc/nginx/nginx.conf:
/******************************/
ser www-data;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
proxy_buffers 8 16k;
proxy_buffer_size 32k;
}
/******************************/
/etc/nginx/sites-enabled/default:
/******************************/
server {
listen 80; ## listen for ipv4
server_name www.toto.com;
access_log /var/log/nginx/localhost.access.log;
error_log /var/log/nginx/localhost.error_log;
# port_in_redirect off;
# server_name_in_redirect off;
root /var/www;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|swf|mp3)$ {
root /var/www;
expires 365d;
access_log off;
}
add_header Cache-Control public;
}
/******************************/
Thanks for any help
Matt