nginx下支持wordpress 的固定链接写法

server{
listen 80;
server_name www.ruantaoni.cn;
root /home/kuangcs/sites/www.ruantaoni.cn;
autoindex on;
index index.html index.htm index.php;
location ~ \.php$ {
root /home/kuangcs/sites/www.ruantaoni.cn;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
#fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /home/kuangcs/sites/www.ruantaoni.cn/$fastcgi_script_name;
include fastcgi_params;
}

#固定连接
location / {
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;
}
}
}

 

 

记下来~~

posted @ 2017-09-14 13:32  大和抚子  阅读(249)  评论(0)    收藏  举报