当前位置: 首页 > 后端技术 > PHP

Nginx配置PathInfo模式

时间:2023-03-29 19:11:02 PHP

http{#客户端允许上传的最大文件大小...!否则会出现http413错误client_max_body_size1000M;server{#监听端口listen80;#如果不设置,它会监听所有的80端口,不一定是127.0.0.1ip下的端口。听127.0.0.1:80;服务器名称test.com;根“d:/Website/sp.com”;indexindex.htmlindex.htmindex.php;location/{#这样可以去掉index.php到demo.com的形式/module/controller/actiontry_files$uri$uri//index.php$uri?$query_string;#是否允许访问目录autoindexon;}location~\.php(.*)${#转发端口fastcgi_pass127.0.0.1:9000;#这里必须有两个捕获组fastcgi_split_path_info^(.+\.php)(\/?.*)$;#下面需要把/script换成$document_root,否则会出现404错误fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_脚本名称;fastcgi_paramPATH_INFO$fastcgi_path_info;fastcgi_paramPATH_TRANSLATED$document_root$fastcgi_path_info;包括fastcgi_params;}}}