wordpress配置固定链接nginx访问404问题解决方法

wordpress配置固定链接nginx访问404问题解决方法

1.在你的nginx 配置文件中加上下面的这一段:

server {

listen 80;

server_name www.ides01.com;

root /var/www/html;

access_log /var/log/nginx/access.log;

error_log /var/log/nginx/error.log;

index index.html index.htm default.php index.php;

location / {

root /var/www/html;

index index.php index.html index.htm;

if (-f $request_filename/index.html){

rewrite (.*) $1/index.html break;

}

if (-f $request_filename/index.php){

rewrite (.*) $1/index.php;

}

if (!-f $request_filename){

rewrite (.*) /index.php;

}

}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

location ~ \.php$ {

fastcgi_pass localhost:9000;

fastcgi_index index.php;

try_files $uri =404;

fastcgi_param SCRIPT_FILENAME

$document_root$fastcgi_script_name;

include fastcgi_params;

}

}

2. 重启nginx

service nginx restart

service php-fpm restart

Leave a Comment