fastcgi_pass unix:/tmp/php-cgi.sock;

本文详细解析了FastCGI配置的关键要素,包括目录权限、执行CGI脚本、内容类型设定及常见错误排查,旨在帮助开发者高效配置FastCGI环境。

fastcgi_pass unix:/tmp/php-cgi.sock;

 

那有那麼複雜 ...

1. 目錄 需有 Options ExecCGI
2. CGI 程式需具可執行狀態
3. 需 AddHandler cgi-script .cgi
4. CGI 程式需自行產生 Content-Type 相關訊息
5. command mode 上先確認 CGI 程式不會有執行上的錯誤

[root@yfw ~]# cd /www/wwwroot/szrengjing.com/chat/dist [root@yfw dist]# curl -I https://szrengjing.com/chat/index.html --http1.1 --insecure curl: (52) Empty reply from server [root@yfw dist]# openssl s_client -connect szrengjing.com:443 -servername szrengjing.com -quiet depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1 verify return:1 depth=1 C = US, O = Let's Encrypt, CN = R13 verify return:1 depth=0 CN = szrengjing.com verify return:1 ^C [root@yfw dist]# ls -l /www/server/panel/vhost/cert/szrengjing.com/ total 8 -rw------- 1 root root 3587 Oct 30 07:44 fullchain.pem -rw------- 1 root root 1703 Oct 30 07:44 privkey.pem [root@yfw dist]# tail -f /www/wwwlogs/szrengjing.com.error.log 2025/11/11 15:22:27 [error] 1187603#0: *722977 FastCGI sent in stderr: "PHP message: PHP Warning: file_get_contents(/www/wwwroot/szrengjing.com/themes/dianpu1/library/member_info.lbi): failed to open stream: No such file or directory in /www/wwwroot/szrengjing.com/includes/cls_template.php on line 165" while reading response header from upstream, client: 144.76.32.114, server: szrengjing.com, request: "GET /supplier.php?go=category&suppId=5&id=43&brand=&price_min=&price_max=&page=&sort=last_update&order=ASC HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com" 2025/11/11 15:22:34 [error] 1187603#0: *722977 FastCGI sent in stderr: "PHP message: PHP Warning: file_get_contents(/www/wwwroot/szrengjing.com/themes/dianpu1/library/member_info.lbi): failed to open stream: No such file or directory in /www/wwwroot/szrengjing.com/includes/cls_template.php on line 165" while reading response header from upstream, client: 144.76.32.114, server: szrengjing.com, request: "GET /supplier.php?go=category&suppId=5&id=44&brand=&price_min=&price_max=&page=&sort=last_update&order=ASC HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com" 2025/11/11 15:22:43 [error] 1187603#0: *722977 FastCGI sent in stderr: "PHP message: PHP Warning: file_get_contents(/www/wwwroot/szrengjing.com/themes/dianpu1/library/member_info.lbi): failed to open stream: No such file or directory in /www/wwwroot/szrengjing.com/includes/cls_template.php on line 165" while reading response header from upstream, client: 144.76.32.114, server: szrengjing.com, request: "GET /supplier.php?go=category&suppId=5&id=45&brand=&price_min=&price_max=&page=&sort=last_update&order=ASC HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com" 2025/11/11 15:22:49 [error] 1187603#0: *722977 FastCGI sent in stderr: "PHP message: PHP Warning: file_get_contents(/www/wwwroot/szrengjing.com/themes/dianpu1/library/member_info.lbi): failed to open stream: No such file or directory in /www/wwwroot/szrengjing.com/includes/cls_template.php on line 165" while reading response header from upstream, client: 144.76.32.114, server: szrengjing.com, request: "GET /supplier.php?go=category&suppId=5&id=46&brand=&price_min=&price_max=&page=&sort=last_update&order=ASC HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com" 2025/11/11 15:33:03 [error] 1187603#0: *735443 FastCGI sent in stderr: "PHP message: PHP Warning: file_get_contents(/www/wwwroot/szrengjing.com/themes/dianpu1/library/member_info.lbi): failed to open stream: No such file or directory in /www/wwwroot/szrengjing.com/includes/cls_template.php on line 165" while reading response header from upstream, client: 66.249.66.33, server: szrengjing.com, request: "GET /supplier.php?go=category&suppId=5&id=19 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com" 2025/11/11 20:41:30 [error] 1187603#0: *807976 FastCGI sent in stderr: "PHP message: PHP Notice: Constant ADMIN_PATH already defined in /www/wwwroot/szrengjing.com/data/config.php on line 29" while reading response header from upstream, client: 85.208.96.208, server: szrengjing.com, request: "GET /supplier/ HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com" 2025/11/11 20:41:33 [error] 1187603#0: *807983 FastCGI sent in stderr: "PHP message: PHP Notice: Constant ADMIN_PATH already defined in /www/wwwroot/szrengjing.com/data/config.php on line 29" while reading response header from upstream, client: 85.208.96.208, server: szrengjing.com, request: "GET /supplier/privilege.php?act=login HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com" 2025/11/11 21:28:29 [error] 1187603#0: *818561 FastCGI sent in stderr: "PHP message: PHP Notice: Constant ADMIN_PATH already defined in /www/wwwroot/szrengjing.com/data/config.php on line 29" while reading response header from upstream, client: 183.7.149.88, server: szrengjing.com, request: "GET /supplier/ HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com", referrer: "https://szrengjing.com/apply_index.php" 2025/11/11 21:28:29 [error] 1187603#0: *818567 FastCGI sent in stderr: "PHP message: PHP Notice: Constant ADMIN_PATH already defined in /www/wwwroot/szrengjing.com/data/config.php on line 29" while reading response header from upstream, client: 27.46.125.46, server: szrengjing.com, request: "GET /supplier/privilege.php?act=login HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-53.sock:", host: "szrengjing.com", referrer: "https://szrengjing.com/apply_index.php" 2025/11/11 21:46:28 [error] 1187603#0: *821544 open() "/www/wwwroot/szrengjing.com/.well-known/traffic-advice" failed (2: No such file or directory), client: 66.249.81.132, server: szrengjing.com, request: "GET /.well-known/traffic-advice HTTP/1.1", host: "szrengjing.com"
11-12
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值