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; } }
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces the Nginx virtual directory configuration file (including PHP configuration and rewriting), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.