设置 nginx 以将 django 和 wordpress 博客作为子目录提供服务

设置 nginx 以将 django 和 wordpress 博客作为子目录提供服务
upstream django {
    server unix:///home/ubuntu/web/www.mysite.com/uwsgi-tutorial/mysite/mysite.sock; # for a file socket
}
server {
    listen      80;
    server_name mysite.com www.mysite.com; 
    charset     utf-8;
    client_max_body_size 75M;   # adjust to taste

    #--------PHP PART -----------------------
    location /blog {
                alias /var/www;
                try_files $uri =404;
                index index.php index.html;
        }

        location ~ /blog/.+\.php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
        }

        location ~ /\.ht {
                deny all;
        }
    #------------------------------- 
    location /media  {
        alias /home/ubuntu/web/www.mysite.com/uwsgi-tutorial/mysite/media;
    }

    location /static {
        alias /home/ubuntu/web/www.mysite.com/uwsgi-tutorial/mysite/static;
    }

    location / {
        uwsgi_pass  django;
        include     /home/ubuntu/web/www.mysite.com/uwsgi-tutorial/mysite/uwsgi_params;
    }
}

我的 nginx<-->uwsgi<-->django 运行正常。mysite.com
[django:运行正常]
mysite.com/blog/index.php [wordpress 无法运行]

信息:https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04[按照此博客设置 wordpress 部分]

相关内容