Nginx簡易實用的php域名配置

server { listen 80; charset utf-8; server_name www.test.com; #綁定域名,空格分割可指向多個域名,或者泛域名*.test.com root /www/test; #網站根目錄 location / { index index.html index.htm; if (-d $request_filename){ rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent; } if (-f $request_filename/index.php){ rewrite ^.*$ $document_uri/index.php last; } if (!-e $request_filename){ rewrite ^(.*)$ /index.php/$1 last; } } location ~ \.php($|/) { fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; # fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章