WordPress索引页(默认帖子网址)可以工作,但是一旦我切换到自定义永久链接,帖子就不会出现
wordpress 5.0.3 nginx 1.14.0
我的nginx文件
server {
listen 80:
listen [::]:80;
server_name www.example.com;
root /var/www/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
location /blog {
alias /var/www/wp;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$args;
}
location /test {
alias /var/www/test;
try_file $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}
我的文件夹结构:
/ var / www / html-> http://www.example.com/
/ var / www / wp-> http://www.example.com/blog
工作:
http://www.example.com/blog/?p=123
不起作用: