![在 Debian 8 上安装 xymon 和 nginx 会导致 cgi 脚本出现 403 错误](https://linux22.com/image/696518/%E5%9C%A8%20Debian%208%20%E4%B8%8A%E5%AE%89%E8%A3%85%20xymon%20%E5%92%8C%20nginx%20%E4%BC%9A%E5%AF%BC%E8%87%B4%20cgi%20%E8%84%9A%E6%9C%AC%E5%87%BA%E7%8E%B0%20403%20%E9%94%99%E8%AF%AF.png)
我正在尝试在 debian 上设置 xymon 和 nginx,并且已经完成初始设置。
但是,每当我点击 CGI 脚本时,我都会收到 403 错误。
这是我的设置:
server {
listen 127.0.0.1:8081;
server_name localhost;
index index.html;
root /var/lib/xymon/www;
error_log /var/log/nginx/xymon.error.log;
access_log /var/log/nginx/xymon.access.log;
location /xymon/ {
alias /var/lib/xymon/www/;
}
location /cgi-bin/ {
alias /usr/lib/xymon/cgi-bin/;
}
location /cgi-secure/ {
alias /usr/lib/xymon/cgi-secure/;
}
location ~ ^/.*\.sh$ {
gzip off;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/lib/xymon/;
fastcgi_param REMOTE_USER $remote_user;
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}
我尝试从这个 freeBSD 设置中调整它: https://blog.feld.me/posts/2014/11/setting-up-xymon-with-nginx/
我收到了一些没用的日志:127.0.0.1 - - [08/Jan/2017:00:25:14 +0100] "GET /cgi-bin/findhost.sh HTTP/1.1" 403 25
有人在 debian 上使用 nginx 设置 xymon 并让它运行吗?
答案1
好的,我成功修复了它!
这是 debian 的正确设置:
server {
listen 127.0.0.1:8081;
server_name localhost;
index index.html;
root /usr/lib/xymon/server/www;
error_log /var/log/nginx/xymon.error.log;
access_log /var/log/nginx/xymon.access.log;
location /xymon/ {
alias /usr/lib/xymon/server/www/;
}
location /cgi-bin/ {
alias /usr/lib/xymon/cgi-bin/;
}
location /cgi-secure/ {
alias /usr/lib/xymon/cgi-secure/;
}
location ~ ^/.*\.sh$ {
gzip off;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /usr/lib/xymon/;
fastcgi_param REMOTE_USER $remote_user;
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}