本文共 1345 字,大约阅读时间需要 4 分钟。
直接记录配置如下user www;worker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; keepalive_timeout 300; sendfile on; server { listen 80; server_name localhost; root /var/www/web; index index.php index.html index.htm; location / { if (-e $request_filename){ break; } if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; break; } rewrite ^/$/index.php last; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; include fastcgi_params; } }}
转载于:https://blog.51cto.com/quietnight/1672882