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.

CompassionPit.com is a Node.js app. The CompassionPit blog is WordPress and the CompassionPit forum is VBulletin. Everything was working fine and dandy until I installed the VBseo plugin for VBulletin, which wants me to add these lines to my nginx configuration:

    location /forum/ {
            rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
            try_files $uri $uri/ /forum/vbseo.php?$args;
    }

    location ~ /forum/(.*\.php)$ {
            rewrite ^/forum/(.*)$ /forum/vbseo.php last;
    }
    location /forum/vbseo/(includes|resources/html|resources/xml)/ {
            allow      127.0.0.1;
            deny      all;
    }

Here's the updated configuration file, including the 3 new blocks, which I placed at the bottom of the file.

server {
    listen       80;                # your server's public IP address
    server_name  www.compassionpit.com;
    index        index.php index.html;

    location ~ ^/$ {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        break;
    }

    location @blogphp {
        internal;
        root /opt/blog;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
        fastcgi_index  index.php;
        fastcgi_pass   127.0.0.1:8080;
        break;
    }

    location ~ ^/(forum|blog)/($|.*\.php) {
        root /opt/;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_index  index.php;
        fastcgi_pass   127.0.0.1:8080;
        break;
    }

    location ~ ^/(blog|forum) {
        root /opt/;
        try_files $uri $uri/ @blogphp;
        break;
    }

    location ~ ^/(forum|blog|vbulletin)/ {
       root /opt/;
       break;
    }

    location @backend {
        internal;
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        break;
    }

    location ~ / {
        root /opt/chat/static/;
        try_files $uri $uri/ @backend;
        break;
    }




    location /forum/ {
            rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
            try_files $uri $uri/ /forum/vbseo.php?$args;
    }

    location ~ /forum/(.*\.php)$ {
            rewrite ^/forum/(.*)$ /forum/vbseo.php last;
    }
    location /forum/vbseo/(includes|resources/html|resources/xml)/ {
            allow      127.0.0.1;
            deny      all;
    }

}

You see, http://www.compassionpit.com/forum/general-discussion/ is getting served by WordPress.

Any suggestions for how I can condense the nginx file to integrate the VBSEO changes?

Thank you!

--Zachary

share|improve this question
add comment

1 Answer

I'm probably mistaken, but it would seem removing the handlers for "forum" in the "(forum/blog)" to just read blog (removing the or logic) would fix this. I'm probably wrong, though, I haven't used any of the products mentioned. Try it though, let us know :)

share|improve this answer
    
In both cases, of course. –  Paul Zaczkowski Sep 8 '11 at 9:07
    
I tried that, it did not yield the desired behavior. I think the file just needs to be totally refactored -- it's a mess. –  Zachary Burt Sep 10 '11 at 15:13
    
I actually found out, just now (since I received the message notification) that there was more to the config than I was able to see on my phone :X Seems I wasn't being shown a scroll bar, when I needed to be D: Sorry if I've wasted any time ;) –  Paul Zaczkowski Sep 12 '11 at 2:02
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.