【问题标题】:Flask and WordPress on the same domain in nginxnginx 中同一域上的 Flask 和 WordPress
【发布时间】:2013-10-18 14:42:11
【问题描述】:

我需要将 Wordpress 博客添加到我的 Flask 网站。 我尝试以这种方式将博客部署到工作 nginx 配置:

server {
listen 80;
server_name localhost;

location / {
    uwsgi_pass unix:/tmp/site.sock;
    include uwsgi_params;
}

location = /blog/ {
   alias /var/www/blog/;
   index index.php;
   try_files $uri $uri/ /blog/index.php?q=$uri?$args;
}


location ~ /blog/.+\.php$ {
   root /var/www/;
   include /etc/nginx/fastcgi_params;
   fastcgi_pass 127.0.0.1:9000;
}

# path for static files
location  /static/ {
    alias /var/www/site/static/;
    autoindex on;
    expires max;
}
}

但是 wordpress 只显示了 404 页(不是标准的,这个页面是专门为博客制作的,并包含在 wordpress 页面中) 否则,我检查了创建的与数据库的连接并且 wp_config 有效。 可能是我错过了 WP 或 nginx 配置中的一些设置吗?

【问题讨论】:

标签: python wordpress nginx flask


【解决方案1】:

你真的没有解释什么位置服务器到底是什么,但如果问题是关于aliastry_files 就像@Seberius 提到的,那么试试 尝试改变

alias /var/www/blog/;

root /var/www/;

然后重新加载nginx

【讨论】:

    猜你喜欢
    • 2021-05-06
    • 1970-01-01
    • 2017-03-27
    • 2017-08-21
    • 1970-01-01
    • 1970-01-01
    • 2016-02-29
    • 2017-03-31
    • 2017-07-23
    相关资源
    最近更新 更多