server { listen 80; server_name www.xxxx.com; root /www/xxxx; location / { index index.html index.htm index.php; if ( !-e $request_filename ){ rewrite ^/(.*)$ /index.php last; break; } } location ~ .*\.(php|php5)?$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /etc/nginx/fastcgi.conf; fastcgi_split_path_info ^(.+\.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; } }
版權聲明:本文為部落客原創文章,未經部落客允許不得轉載。
以上就介紹了Nginx虛擬目錄設定檔(包含PHP設定與重寫),包含了面向的內容,希望對PHP教學有興趣的朋友有幫助。