Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Below is my Nginx.conf -

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
   worker_connections  1024;
}


http {
 include       mime.types;
 default_type  application/octet-stream;

 #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
 #                  '$status $body_bytes_sent "$http_referer" '
 #                  '"$http_user_agent" "$http_x_forwarded_for"';

 #access_log  logs/access.log  main;

 sendfile        on;
 #tcp_nopush     on;

 #keepalive_timeout  0;
 keepalive_timeout  65;

 gzip  on;
 gzip_disable "MSIE [1-6]\.(?!.*SV1)";
 include /usr/local/nginx/conf/sites-enabled/*;
}

my sites-available conf -

server {
    listen   80;
    server_name 1.2.3.4;
    #server_name abc.in;

    access_log  /usr/local/nginx/logs/abc.access.log;

    location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8080/abc;
    }
 }

On the browser I am getting two slashes "//" after I type in the IP address and the message "This web page has a redirect loop". Can anyone please help me identify the problem please?

Thanks.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Try reading documentation: http://wiki.nginx.org/HttpProxyModule

While passing request nginx replaces URI part which corresponds to location with one indicated in proxy_pass directive.

You should add trailing slash '/' after abc to not loose it after transformation or you will get /abcindex.html, not /abc/index.html.

share|improve this answer
    
Thank you sir. Adding the "/" worked. Thanks so much! –  RockyJ Jun 11 '12 at 14:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.