因此,我有一个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;
}
}
答案 0 :(得分:0)
您确定已在阅读中的WordPress管理区域内正确设置了永久链接吗?可能就像重置并保存更改一样简单。