nginx、php-fcgi、VBulletin、Wordpress 和 Node.js

nginx、php-fcgi、VBulletin、Wordpress 和 Node.js

CompassionPit.com 是一款 Node.js 应用。CompassionPit 博客是 WordPress,CompassionPit 论坛是 VBulletin。一切都运行良好,直到我为 VBulletin 安装 VBseo 插件,它要求我将以下几行添加到我的 nginx 配置中:

    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;
    }

这是更新后的配置文件,包括 3 个新块,我将它们放在文件底部。

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;
    }

}

你看,http://www.compassionpit.com/forum/general-discussion/由 WordPress 提供服务。

关于如何压缩 nginx 文件以整合 VBSEO 更改,有什么建议吗?

谢谢你!

--扎卡里

答案1

我可能搞错了,但似乎删除“(forum/blog)”中“forum”的处理程序以只读取博客(删除或逻辑)可以解决这个问题。但我可能错了,我没有使用过上述任何产品。试试看,让我们知道 :)

相关内容