I'm trying to use Nginx as reverse proxy with Apache to cache static files, etc. I'm having an issue on a new install, that it's not passing on URIs to Apache. Basically I have a vBulletin forum, and I'm using vBSEO as the SEO proxy. The problem is it's generating 404s for every URL, except files that already exist.

link|improve this question

50% accept rate
feedback

2 Answers

up vote 2 down vote accepted

Could you possibly give us the relevant portion of your nginx configuration? A.t.m. we cannot guess what's wrong (although one might: using 'localhost' when not in the hosts file, so not resolving to 127.0.0.1, wrong portnumber for apache, forgetting to add a host header, etc.). Normally, It'd be something like:

server {
    listen       80;
    server_name  www.example.com;

    # normally some checking here for static content which exists as file 
    # like images, js, etc, with a 'break', with at the end:

    location / {
        proxy_pass         http://127.0.0.1:<portnumber apache is on>/;
        proxy_redirect     off;
        proxy_set_header   Host $host;
    }
}
link|improve this answer
feedback

Well I traced it down to the SEO friendly plugin ( vBSEO ). It was producing links with .html extension and it seems nginx had it set for caching. Since those links didn't exist physically, it was producing the 404s.

link|improve this answer
Ah, you do know you can let nginx check for the existance of a file and resort to proxying if not found? – Wrikken Jun 15 '10 at 10:23
Well that was already added to the rules. The basic fact was that it was proxying all together because the extension was there. – Adrian A. Jun 18 '10 at 1:58
feedback

Your Answer

 
or
required, but never shown

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