gpt4 book ai didi

perl + nginx 再次出现403错误

转载 作者:行者123 更新时间:2023-12-02 09:32:18 26 4
gpt4 key购买 nike

让 Perl 和 nginx 发挥良好似乎是一场永无止境的战斗:( 我已经设置了一个新的开发服务器。我不会让你厌烦所有的细节,但足以说明我已经安装了(通过 apt-get);

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install nginx
sudo apt-get install php5-cli php5-cgi spawn-fcgi php-pear
sudo apt-get install mysql-server php5-mysql
sudo apt-get install fcgiwrap

然后我配置了我的站点,使用:

server {

listen 80;

server_name site.net.net www.site.net.net;
access_log /srv/www/site.net.net/logs/access.log;
error_log /srv/www/site.net.net/logs/error.log;
root /srv/www/site.net.net/www;

location / {
index index.html index.htm;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/site.net.net/www$fastcgi_script_name;
}

location ~ \.cgi$ {
try_files $uri =404;
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /srv/www/site.net.net/www/cgi-bin/$fastcgi_script_name;
}

}

我已经将配置文件符号链接(symbolic link)到启用站点,以便它在 nginx 上可见。然后我重新启动了 nginx,并尝试:

index.html - works fine
index.php - works fine
index.cgi - 403 error

上次我设法摸索着通过它,但我无法弄清楚我做了什么不同(我知道这是一个真正的 pig 第一次配置)

error_log 中唯一显示的是:

2015/07/31 15:52:25 [error] 10434#0: *7 open() "/srv/www/site.net/www/favicon.ico" failed (2: No such file or directory), client: 81.174.134.xx, server: sitenet, request: "GET /favicon.ico HTTP/1.1", host: "site.net"

所以帮助不大:/

专家有什么建议吗?

更新:

如果我将错误日志更新为“调试”级别,即:

error_log /srv/www/steampunkjunkiesdev.net/logs/error.log debug;

...下面是输出的内容(仅来自 1 个请求)。不确定其中是否有任何帮助?

Server: nginx/1.6.2
Date: Fri, 31 Jul 2015 15:11:49 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip

2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:1 f:0 0000000000F049D8, pos 0000000000F049D8, size: 185 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 http write filter: l:0 f:0 s:185
2015/07/31 16:11:49 [debug] 3557#0: *1 http output filter "/favicon.ico?"
2015/07/31 16:11:49 [debug] 3557#0: *1 http copy filter: "/favicon.ico?"
2015/07/31 16:11:49 [debug] 3557#0: *1 image filter
2015/07/31 16:11:49 [debug] 3557#0: *1 xslt filter body
2015/07/31 16:11:49 [debug] 3557#0: *1 http postpone filter "/favicon.ico?" 0000000000F04AF8
2015/07/31 16:11:49 [debug] 3557#0: *1 http gzip filter
2015/07/31 16:11:49 [debug] 3557#0: *1 malloc: 0000000000EED690:12288
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:1 s:5936 a:8192 p:0000000000EED690
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:512 s:2 a:1024 p:0000000000EEF690
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:512 s:2 a:1024 p:0000000000EEFA90
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:512 s:2 a:1024 p:0000000000EEFE90
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip alloc: n:256 s:4 a:1024 p:0000000000EF0290
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in: 0000000000EF6EE8
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in_buf:0000000000F04AA8 ni:00000000006DC600 ai:116
2015/07/31 16:11:49 [debug] 3557#0: *1 malloc: 0000000000EF06A0:4096
2015/07/31 16:11:49 [debug] 3557#0: *1 deflate in: ni:00000000006DC600 no:0000000000EF06A0 ai:116 ao:4096 fl:0 redo:0
2015/07/31 16:11:49 [debug] 3557#0: *1 deflate out: ni:00000000006DC674 no:0000000000EF06A0 ai:0 ao:4096 rc:0
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in_buf:0000000000F04AA8 pos:00000000006DC600
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in: 0000000000EF6EF8
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in_buf:0000000000EF6E20 ni:00000000006DCDA0 ai:52
2015/07/31 16:11:49 [debug] 3557#0: *1 deflate in: ni:00000000006DCDA0 no:0000000000EF06A0 ai:52 ao:4096 fl:4 redo:0
2015/07/31 16:11:49 [debug] 3557#0: *1 deflate out: ni:00000000006DCDD4 no:0000000000EF0711 ai:0 ao:3983 rc:1
2015/07/31 16:11:49 [debug] 3557#0: *1 gzip in_buf:0000000000EF6E20 pos:00000000006DCDA0
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000EED690
2015/07/31 16:11:49 [debug] 3557#0: *1 http chunk: 10
2015/07/31 16:11:49 [debug] 3557#0: *1 http chunk: 121
2015/07/31 16:11:49 [debug] 3557#0: *1 write old buf t:1 f:0 0000000000F049D8, pos 0000000000F049D8, size: 185 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:1 f:0 0000000000EF7058, pos 0000000000EF7058, size: 4 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:0 f:0 0000000000000000, pos 00000000006E0240, size: 10 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:1 f:0 0000000000EF06A0, pos 0000000000EF06A0, size: 121 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 write new buf t:0 f:0 0000000000000000, pos 00000000004B2EB8, size: 7 file: 0, size: 0
2015/07/31 16:11:49 [debug] 3557#0: *1 http write filter: l:1 f:1 s:327
2015/07/31 16:11:49 [debug] 3557#0: *1 http write filter limit 0
2015/07/31 16:11:49 [debug] 3557#0: *1 writev: 327
2015/07/31 16:11:49 [debug] 3557#0: *1 http write filter 0000000000000000
2015/07/31 16:11:49 [debug] 3557#0: *1 http copy filter: 0 "/favicon.ico?"
2015/07/31 16:11:49 [debug] 3557#0: *1 http finalize request: 0, "/favicon.ico?" a:1, c:1
2015/07/31 16:11:49 [debug] 3557#0: *1 set http keepalive handler
2015/07/31 16:11:49 [debug] 3557#0: *1 http close request
2015/07/31 16:11:49 [debug] 3557#0: *1 http log handler
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000EF06A0
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000000000
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000F03B20, unused: 8
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000EF6A40, unused: 2156
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000F09E70
2015/07/31 16:11:49 [debug] 3557#0: *1 hc free: 0000000000000000 0
2015/07/31 16:11:49 [debug] 3557#0: *1 hc busy: 0000000000000000 0
2015/07/31 16:11:49 [debug] 3557#0: *1 reusable connection: 1
2015/07/31 16:11:49 [debug] 3557#0: *1 event timer add: 14: 65000:1438355574073
2015/07/31 16:11:49 [debug] 3557#0: *1 post event 0000000000F4A118
2015/07/31 16:11:49 [debug] 3557#0: *1 delete posted event 0000000000F4A118
2015/07/31 16:11:49 [debug] 3557#0: *1 http keepalive handler
2015/07/31 16:11:49 [debug] 3557#0: *1 malloc: 0000000000F09E70:1024
2015/07/31 16:11:49 [debug] 3557#0: *1 recv: fd:14 -1 of 1024
2015/07/31 16:11:49 [debug] 3557#0: *1 recv() not ready (11: Resource temporarily unavailable)
2015/07/31 16:11:49 [debug] 3557#0: *1 free: 0000000000F09E70

最佳答案

呃,我现在觉得自己像个白痴!在我的配置中,我有:

location ~ \.cgi$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /srv/www/site.net/www/cgi-bin$fastcgi_script_name;
}

但是,SCRIPT_FILENAME 是错误的...应该是:

location ~ \.cgi$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /srv/www/site.net/www/$fastcgi_script_name;
}

(请注意倒数第二行缺少的/cgi-bin)。当你看到它时,就这么简单!只是想我会分享它,希望它能在将来的某个时候帮助其他人。呸!

关于perl + nginx 再次出现403错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31746462/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com