server {
listen 80;
server_name www.test.com;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
# \.php 只处理动态请求,对于静态资源请求由下面的 location匹配和处理
location ~ \.php {
root "D:/";
fastcgi_pass 127.0.0.1:9000;
#包含nginx服务器传递给fastcgi程序的参数,php中通过$_SERVER['参数名']可获取
include fastcgi.conf;
#定义变量$fastcgi_script_name_new赋值为$fastcgi_script_name变量
set $path_info "";
set $fastcgi_script_name_new $fastcgi_script_name;
#判断url是否是pathinfo形式的,如果是则把这个url分割成两部分,index.php入口文件之后的pathinfo部分存入$path_info变量中,剩下的部分和$document_root根目录定位index.php入口文件在文件系统中的绝对路径 .
if ($fastcgi_script_name ~* "^(.+\.php)(/.+)$" ) {
set $fastcgi_script_name_new $1;
set $path
tp3.2 nginx 配置访问路径问题
最新推荐文章于 2023-01-30 14:03:31 发布
server { listen 80; server_name www.test.com; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; # \.php 只处理动态请求,对于静态资源请求由下面的 location匹配和处理 ...
摘要由CSDN通过智能技术生成