此教程适用于集成安装包lnmp,官网是https://lnmp.org/
一、 开启pathinfo
#注释 下面这一行 #include enable-php.conf #载入新的配置文件 include enable-php-pathinfo.conf

二、 开启rewrite
在server最后添加如些的配置
#添加如下 location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; break; } } location ~ /index.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/index.php; include fastcgi_params; fastcgi_param APPLICATION_ENV dev; }

三、 重启服务
service nginx restart
本文详细介绍了如何在LNMP环境中开启pathinfo及rewrite功能,并提供了具体的Nginx配置示例,帮助读者完成网站URL美化及SEO优化。
840

被折叠的 条评论
为什么被折叠?



