【问题标题】:NGINX 404 for sub folders on wordpressNGINX 404 用于 wordpress 上的子文件夹
【发布时间】:2019-07-29 22:30:41
【问题描述】:

所以我有一个 nginx 服务器,我有一堆 wordpress 网站 像这样

/var/www/html/siteone
/var/www/html/sitetwo

当我使用浏览器转到http://localserver/siteone 时,它可以工作,但是当我转到子文件夹或子页面时,例如http://localserver/siteone/about,它总是404。

我知道您应该设置多个位置块,但我不想这样做!我希望能够将文件夹添加到根目录,放入 wordpress 文件,一切正常。有什么建议吗?

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.php index.html index.htm index.nginx-debian.html;

        server_name _;


        location / {

                #try_files $uri $uri/ =404;
                index index.php index.html index.htm;


                #try_files $uri $uri/ /index.php?$args;
                try_files $uri $uri/ /index.php$is_args$args;

                fancyindex on;
                fancyindex_localtime on;
                fancyindex_exact_size off;
                fancyindex_header "/Nginx-Fancyindex-Theme-light/header.html";
                fancyindex_footer "/Nginx-Fancyindex-Theme-light/footer.html";
                fancyindex_ignore "Nginx-Fancyindex-Theme-light";
                fancyindex_ignore "phpmyadmin";

        }

        location ~ \.php$ {

                client_max_body_size 1024M;

                include snippets/fastcgi-php.conf;
                # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                fastcgi_intercept_errors on;

                # With php-cgi (or other tcp sockets):
                #fastcgi_pass 127.0.0.1:9000;
        }


        location ~ /\.ht {
                deny all;
        }

}

【问题讨论】:

    标签: wordpress nginx


    【解决方案1】:

    您确定已在正在阅读的 wordpress 管理区域内正确设置了永久链接吗?可能就像重置并保存更改一样简单。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-22
      • 2015-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-22
      • 1970-01-01
      相关资源
      最近更新 更多