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; }}}
记下来~~
转载于:https://www.cnblogs.com/dahefuzi/p/7520149.html
相关资源:WordPress与Drupal的Nginx配置rewrite重写规则示例