nginx - proxy_pass is working - Apache isn't doing what it should...
Posted
by matthewsteiner
on Server Fault
See other posts from Server Fault
or by matthewsteiner
Published on 2010-05-27T00:23:47Z
Indexed on
2010/05/27
0:33 UTC
Read the original article
Hit count: 277
So, I've got this in my nginx.conf:
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
root /var/www/vhosts/example.com/public/;
access_log off;
expires 30d;
}
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
So anything that is a "static file" that exists will just be done with nginx. Otherwise, it should pass it off to Apache. Right now, static files are working correctly. However, if something is passed to apache and it's example.com or subdomain.example.com, apache just spits out the "Apache 2 Test Page" that you get if there's nothing there.
Apache worked fine before, so I'm guessing it has to do with the way nginx is "asking". I'm not sure though. Any ideas?
© Server Fault or respective owner