server{ listen 80; server_name test.eoews.cn; #项目文件的路径 root "D:/developer/study/PHPTutorial/WWW/project/eoews"; #默认寻找打开文件 location / { #默认打开的文件 index index.html index.htm index.php l.php; #打开目录浏览功能 autoindex off; #重写机制 if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } #将服务器错误重定向到指定的静态页面中 error_page 500 502 503 504 D:/developer/study/PHPTutorial/nginx/html/50x.html; location = /50x.html { root D:/developer/study/PHPTutorial/nginx/html; } location ~ .php(.*)$ { 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; } }