虽然这个问题网上已经有很多人回答过了,但是还是不能解决我的问题。Nginx上的wordpress,除了首页外,其它页面全部出现404。
下面是nginx的配置:
server {
listen 80 ;
listen [::]:80;
root /var/www/html/p/swear;
index index.php index.html index.htm;
server_name skinnybikiniswimwear.org;
location / {
try_files $uri /$uri/ /index.php?args =404;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $uri /index.php?args =404;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
从这个配置我找不出有什么问题。
wordpress安装在/var/www/html/p/swear。
多谢.
最佳答案
尝试如下配置:
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$is_args$args =404;
}
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
许多wordpress上配置nginx不成功,大多数是重写规则不对导致的404问题。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)