运行fastcgi-> php作为博客子文件夹,而网站的其余部分是fastcgi-> django

一个奇怪的问题,但应该很容易解决.我正在开发一个Django网站,客户也需要一个wordpress博客.因为我们在枪口下并且还有其他项目,所以我们没有时间建立一个不错的django博客,所以我们在子文件夹中给他们wordpress.

我有很多使用Nginx的经验,但之前从未做过这样的事情,而且我对正则表达式并不是很有天赋.

这是结构:

blog (the wordpress blog)
contact
__init__.py
manage.py
settings.py
static (all my static media,htdocs directory)
templates
urls.py
wsgi.py

到目前为止,它是超轻量级的,只有一个应用程序(联系应用程序).我希望域名/博客能够访问/ blog /文件夹并将静态媒体视为静态媒体,并将PHP文件PHP文件代理到我的fastcgi进程中.

当然我希望其他一切都可以和Django一起使用,转到我的python fastcgi进程.

为了记录,一切正常,除了这个Nginx配置.我所有的fcgi进程都很好.这是我的Nginx配置:

# David Simons Website
server {
    listen       80;
    server_name  ********;

    root /usr/local/simons/static;

    index index.html index.PHP;

    location / {
        fastcgi_pass 127.0.0.1:3033;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param SERVER_NAME $server_name;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_pass_header Authorization;
        fastcgi_intercept_errors off;
    }

    location ^~ /static/ {
        alias /usr/local/simons/static/;
    }

    location ^~ /blog/ {
        root /usr/local/simons/;
    }

    location ~* \.PHP${
       fastcgi_pass   127.0.0.1:9000;
       include /etc/Nginx/fastcgi.conf;
       fastcgi_param  SCRIPT_FILENAME  /usr/local/simons/$fastcgi_script_name;
    }

    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)${
        access_log  off;
        expires 30d;
        break;
    }

}
最佳答案
你为什么不这样做呢

location /blog {
    fastcgi_pass
    etc. 
}

相关文章

Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一...
本地项目配置 1 复制 luffy/settings/dev.py为prop.py 修改l...
nginx不仅可以隐藏版本信息,还支持自定义web服务器信息 先看...
一 、此次漏洞分析 1 nginx HTTP/2漏洞 [nginx-announce] ng...
###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "ima...