wordpress - 使用 Nginx 更新永久链接后找不到 404 页面
wordpress - 404 page not found after updating permalinks w Nginx
我更改了 permalinks 结构以使用邮寄名
我重新启动了 Nginx 以清除缓存,但即使我可以显示我的主页,当我点击任何 oage link 时,我得到一个 404 页面未找到 ...
使用 Nginx,我不必更新 .htaccess 文件,但我应该更新我的站点 Nginx conf 文件吗...
这里是与 .php
一起使用的位置部分
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; }
感谢反馈
将 /location 更新为
location / {
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
现在工作正常...
这不是一个完整的文件部分!服务器 { } 丢失。
使用这个但在服务器 { } 之间使用这个应该可以工作
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
我更改了 permalinks 结构以使用邮寄名 我重新启动了 Nginx 以清除缓存,但即使我可以显示我的主页,当我点击任何 oage link 时,我得到一个 404 页面未找到 ...
使用 Nginx,我不必更新 .htaccess 文件,但我应该更新我的站点 Nginx conf 文件吗...
这里是与 .php
一起使用的位置部分 location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; }
感谢反馈
将 /location 更新为
location / {
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
现在工作正常...
这不是一个完整的文件部分!服务器 { } 丢失。
使用这个但在服务器 { } 之间使用这个应该可以工作
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}