nginx 配置 支持 访问 thinkphp5
server { // 这个在windows 下配置是ok的,linux 下不知道是否可以生效! 待后续验证 listen 8999; server_name localhost; location / { root D:/phpstudy_pro/WWW/tp5/public; // 这里是tp5 public 入口文件 index index.html index.htm; try_files $uri $uri/ /index.php?s=$uri&$args; // 表示
#如果请求不是文件或目录,则将uri交给index.php处理,同时保留参数
if ( !-e $request_filename) { rewrite ^(.*)$ /index.php/?s=$1 last; //进行URL重写,将默认访问URL中的index.php?s=通过rewrite隐藏 break; } } location ~ \.php(.*)$ { root D:/phpstudy_pro/WWW/tp5/public; //tp5 入口文件 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } }
上图:
本文作者:努力不搬砖的iori
本文链接:https://www.cnblogs.com/Hijacku/p/15926227.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步