fastcgi
fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/path/to/php-fpm.sock;
fastcgi_param
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 一般只需要这个 include fastcgi_params; 其他的参数都写在这个文件中了
fastcgi_pass_header X-Forwarded-For 显示 header fastcgi_hide_header X-Forwarded-For 隐藏 header
fastcgi_index index.php;
fastcgi_split_path_info
如果访问: http://localhost/index.php/Home/Index/index.html
location ~ \.php { fastcgi_split_path_info ^(.*\.php)(.*)$; # 经过上面的配置之后, $fastcgi_script_name 就会变成 /index.php, $fastcgi_path_info 就会变成 /Home/Index/index.html fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; }
另一种配置 path_info 方式
location ~ (.*\.php)(.*)$ { fastcgi_param SCRIPT_FILENAME $document_root$1; fastcgi_param PATH_INFO $2; }
buffer
fastcgi_buffers 8 4k; 8 个 buffer, 每个 4k fastcgi_buffer_size 4k; 默认和上面的一样
fastcgi_next_upstream error | timeout | invalid_header | off
时间: 2024-12-18 21:14:54