1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| server{ listen 80; server_name baidu.com; index index.php index.htm index.html; root /www/baidu.com; access_log /var/log/nginx/baidu.com.access.log; error_log /var/log/nginx/baidu.com.error.log; # 新增下面这一行就可以了 try_files $uri $uri/ /index.php$is_args$query_string; location ~ .*\.php$ { fastcgi_pass unix:///tmp/php-cgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; include fastcgi.conf; include pathinfo.conf; set $real_script_name $fastcgi_script_name; } }
|