Nginx for static files, Apache isn't working now...

Posted by matthewsteiner on Stack Overflow See other posts from Stack Overflow or by matthewsteiner
Published on 2010-05-27T02:07:15Z Indexed on 2010/05/27 2:11 UTC
Read the original article Hit count: 331

Filed under:
|
|
|

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. Here's 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;
}

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?

© Stack Overflow or respective owner

Related posts about apache

Related posts about nginx