AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 475251
Accepted
Dr I
Dr I
Asked: 2013-02-05 08:28:19 +0800 CST2013-02-05 08:28:19 +0800 CST 2013-02-05 08:28:19 +0800 CST

Nginx 和 Nagios 通过 FastCGI 处理程序,403 错误

  • 772

我目前正在更新我的 Web 平台并从 Apache 切换到 Nginx。

所以我必须在做之前测试我们所有的管理和内部应用程序。

好吧,到目前为止,我没有遇到任何问题,但是没有它会有点太容易了:D

所以,今天,我使用以下组件安装我的监督平台:

  • 操作系统:Debian Squeeze 6.0.6
  • 网络服务器:Nginx 1.2.5
  • FastCGI:fcgiwrap 1.0.3-3
  • PHPCGI:PHP 5.4.11
  • 监管:Nagios 3.4.3

这是我的目录结构:

/usr/local/$APPNAME$/$SUBTREE$ --> Aim for all binaries and libraries outside the OS.
/etc/$APPNAME$/$SUBTREE$ --> Directory for all binaries configuration files.
/srv/apps/$WEBAPPNAME$/$SUBTREE$/ --> Directory for all HTML/PHP/CGI related files.

在这些之后我得到了:

/usr/local/nagios/ all owned by nagios user/group.
/usr/local/nginx/ all owned by nginx user/group.
/usr/local/fcgiwrap/ all owned by nginx user/group.
/usr/local/phpcgi/ all owned by nginx user/group.

&

/etc/nagios/ all owned by nagios user/group.
/etc/nginx/ all owned by nginx user/group.

&

/srv/app/nagios/{cgi-bin;stylesheets;etc} all owned by nginx.

我的 PhpCGI Wrapper 运行良好并按要求提供 PHP 页面,因为我已经正确显示了 Nagios 主页。

问题似乎来自我的 FastCGI Wrapper,它不停地发送一个愚蠢的错误,声称没有使用任何 DOCUMENT_ROOT 或 SCRIPT_FILENAME 参数调用它。

但是,关于我的 Nginx 配置,一切似乎都正常。

我在另一个 ServerFault 问题上找到了相关内容,但 FastCGI 包装器的升级对我没有帮助。

这是我的 NGinx 配置:

  1 user                    nginx nginx;
  2 worker_processes        4;
  3 pid                     /var/run/nginx/nginx.pid;
  4 error_log               /var/log/nginx/error.log;
  5
  6 events {
  7     worker_connections 1024;
  8 }
  9
 10
 11 http {
 12     include             mime.types;
 13     default_type        application/octet-stream;
 14     sendfile            on;
 15     keepalive_timeout   65;
 16     gzip                on;
 17
 18 upstream fcgiwrap {
 19         server unix:/var/run/fcgiwrap.socket;
 20 }
 21
 22
 23     server {
 24         listen                  443;
 25         server_name             nagios.domain.tld;
 26         root                    /srv/apps/nagios;
 27         ssl                     on;
 28         ssl_certificate         /etc/nginx/security/cert.crt;
 29         ssl_certificate_key     /etc/nginx/security/cert.key;
 30         ssl_session_timeout     5m;
 31         ssl_protocols           SSLv2 SSLv3 TLSv1;
 32         ssl_ciphers             HIGH:!aNULL:!MD5;
 33         ssl_prefer_server_ciphers on;
 34
 35         charset         utf8;
 36         access_log      /var/log/nginx/access.log;
 37
 38         location / {
 39                 index index.php;
 40                 auth_basic "Nagios Restricted Access";
 41                 auth_basic_user_file /etc/nagios/passwd.users;
 42         }
 43
 44         location ~\.php$ {
 45                 auth_basic "Nagios Restricted Access";
 46                 auth_basic_user_file /etc/nagios/passwd.users;
 47                 include fastcgi_params;
 48                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 49                 fastcgi_pass 127.0.0.1:9000;
 50         }
 51
 52         location ~\.cgi$ {
 53                 auth_basic "Nagios Restricted Access";
 54                 auth_basic_user_file /etc/nagios/passwd.users;
 55                 include fastcgi_params;
 56                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 57                 fastcgi_param AUTH_USER $remote_user;
 58                 fastcgi_param REMOTE_USER $remote_user;
 59                 fastcgi_pass fcgiwrap;
 60         }
 61     }
 62 }

Fcgiwrap 套接字由 nginx 处理,我的所有权限似乎都很好。

因此,如果您有任何线索或帮助,我们将不胜感激:D

提前致谢。

nginx
  • 1 1 个回答
  • 4309 Views

1 个回答

  • Voted
  1. Best Answer
    Moonshine
    2013-04-30T22:00:04+08:002013-04-30T22:00:04+08:00

    查看以 nginx 用户/组身份运行的 fcgiwrap。不确定 Debian,但在 RHEL/CentOS 中,Nagios RPM 安装脚本通过以下方式将 nagios 组添加到 apache 用户:

    /usr/sbin/usermod -a -G nagios apache
    

    可以用

    id apache
    

    这允许 Apache 获取 Nagios 对象信息/状态。你会想要给 nginx 相同的 nagios 组权限。

    • 1

相关问题

  • Gzip 与反向代理缓存

  • nginx 作为代理的行为

  • Nginx 学习资源 [关闭]

  • 提供 70,000 个静态文件 (jpg) 的最佳方式?

  • 在 Apache、LightTPD 和 Nginx Web 服务器上提供 PHP 5.x 应用程序的现状?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve