开发者社区> 问答> 正文

同一Ubuntu服务用Nginx跑Django和Wordpress如何设置?

租用的是aliyun服务器,现在上面跑着Django+fastcgi,运行正常。想加个wordpress博客上去,用php5-fpm。
blog.conf配置:

server {
listen 80;
server_name blog.joinwee.com;
error_log /alidata1/wwwlogs/blog.error.log;
access_log /alidata1/wwwlogs/blog.access.log;

location / {
        index index.html index.htm index.php;
        root /alidata1/wordpress/;
        if (-f $request_filename/index.html){
                rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
                rewrite (.*) /index.php;
        }

}
location ~ \.php$ {
        include fastcgi_params;
        fastcgi_index index.php;
        #fastcgi_pass 127.0.0.1:53217;
        #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        }
}

想使用二级域名blog.joinwee.com,重动了php5-fpm的,但访问时仍是提示无法访问此网页

请问服务器能同时跑这django和php吗?该如何设置?

展开
收起
落地花开啦 2016-06-16 15:11:25 2663 0
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人

    要用两个server块,分别按照django和php的方式写。
    写完注意重启下Nginx(或者reload)。

    2019-07-17 19:40:57
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载