<p>谢谢你帮我解决这个问题。在</p>
<p>这是解决办法</p>
<p><strong>Django应用程序目录</strong>-/home/ubuntu/Django</p>
<p><strong>Wordpress目录</strong>-/var/www/html/blog</p>
<p><strong>NGINX Conf文件</strong></p>
<pre><code>server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ /blog/.*\.php$ {
root /var/www/html;
index index.php index.html index.htm;
set $php_root /var/www/html/blog;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location /blog {
root /var/www/html;
index index.php index.html index.htm;
set $php_root /var/www/html/blog;
try_files $uri $uri/ /blog/index.php;
}
location /static/ {
alias /home/ubuntu/django/your_app_name/static/static_root/;
}
location /media/ {
alias /home/ubuntu/django/your_app_name/media/ ;
}
}
</code></pre>
<p><strong>注意-</strong>请在wordpress的wp location表中将home和siteurl替换为<strong><a href="http://example.com/blog" rel="nofollow noreferrer">http://example.com/blog</a></strong></p>
<p>现在你的Django应用正在运行example.com网站在</p>
<p>现在你的博客正在运行example.com/blog在</p>