Newbie questions about nginx (moving from apache)

pk899 nginx-forum at nginx.us
Sat May 28 17:55:10 MSD 2011


Thanks. But I am a bit confused, as the simple setup is not working from
port 81 (for testing): 


  server {
    listen 81;
    server_name MYDOMAIN.com www.MYDOMAIN.com;

    location ^~ /site/static {
      root /home/MYDOMAIN/www/static;
      index index.htm index.php;
      expires       30d;
      gzip          on;
    }
    
    location / {
      proxy_pass      http://127.0.0.1:80/;
      proxy_redirect  off;
      
      proxy_set_header   Host             $host;
      proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }

  }



Then I try in my browser this: 
http://MYDOMAIN.com:81/test.gif    

On the server the "test.gif" file is at
"/home/MYDOMAIN/www/static/test.gif". 

Questions: 

(1) What am I missing? Should the test.gif file be somewhere else?
Should I try this with some other URL instead of the one I mention
above? 

(2) Also, if this worked, and I accepted Nginx to be at the front and
moved Apache to the background, isn't it true that Apache would have to
pass back all processed output to Nginx? 

(3) Even with "proxy_redirect off", when I try http://MYDOMAIN.com:81,
it actually does a hard 301 redirect to my Apache server. 

What am I missing?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,201449,201787#msg-201787




More information about the nginx mailing list