手机版

部署在Nginx的wordpress全部页面都出现404错误

时间:2020-03-29 来源:互联网 编辑:宝哥软件园 浏览:

问题

虽然这个问题网上已经有很多人回答过了,但是还是不能解决我的问题。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问题。

版权声明:部署在Nginx的wordpress全部页面都出现404错误是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。

相关文章推荐