同一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吗?该如何设置?

django php nginx

大绅士油鸡 10 years, 5 months ago

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

Chronos answered 10 years, 5 months ago

Your Answer