【发布时间】:2019-08-02 08:19:24
【问题描述】:
是否可以使用 nginx 在现有烧瓶应用程序的 /blog 上启用 wordpress?这是我一直在使用但没有得到任何结果的配置。我可以让烧瓶或 wordpress 通过 nginx 工作,但是
1) 不能同时
2) 不启用 /blog 选项的 wordpress(wordpress 在 / 但不是 /blog 工作)
server {
listen 80;
server_name 0.0.0.0;
#### if I enable the flask app, the blog doesn't work, so how can I keep this as well as add /blog ####
# location / {
# include uwsgi_params;
# uwsgi_pass unix:/var/www/html/cr_webapp/my_app.sock;
#}
#### if I change / to /blog, it starts looking in /usr/share/nginx/html location ####
location = / {
#root /var/www/html/blog;
index index.php;
try_files $uri $uri/ /blog/index.php?q=$uri?$args;
}
location = /favicon.ico {
root /var/www/html/blog;
log_not_found off;
access_log off;
}
location = /robots.txt {
root /var/www/html/blog;
allow all;
log_not_found off;
access_log off;
}
location ~ \.php$ {
root /var/www/html/blog;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
root /var/www/html/blog;
expires max;
log_not_found off;
}
}
我查看了a link,但该解决方案对我不起作用。另外,当我使用 /blog 时,它默认为 --prefix 位置,所以不知道如何更改它 - a link
我正在尝试做的事情可能吗?或者我一直无知。
【问题讨论】: