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 / 问题 / 653960
Accepted
aag
aag
Asked: 2014-12-21 12:55:26 +0800 CST2014-12-21 12:55:26 +0800 CST 2014-12-21 12:55:26 +0800 CST

Nagios + Nginx:CSS 和图像问题

  • 772

我在 Nginx 提供的 Arch Linux 上配置 Nagios 时遇到问题。Nagios 服务运行顺利,但通过 Nginx 提供的服务中断。从截图可以看出,字体全乱了,图标也没有出现在浏览器中。我怀疑 CSS 和图像文件的路径以某种方式被破坏,因此 Nginx 没有分割。

Nagios 截图

这是我的 Nginx 虚拟服务器配置文件。我假设我犯了一些愚蠢的错误,但我无法发现问题。

错误日志显示以下内容:

*334 open() "/usr/share/nagios/share/nagios/images/ndisabled.gif" failed (2: No such file or directory)

但是,GIF 位于/usr/share/nagios/share/images/ndisabled.gif表明路径存在一些混淆,但是我不知道如何最好地修复。

漫游这个论坛的一位或其他 Nginx/Nagios 专家可能会在一微秒内找到问题!

server {
    server_name     nagios.bellaria www.nagios.bellaria;
    root            /usr/share/nagios/share;
    listen          80;
    index           index.php index.html index.htm;
    access_log      nagios.access.log;
    error_log       nagios.error.log;

    auth_basic            "Nagios Access";
    auth_basic_user_file  /etc/nagios/htpasswd.users;

    location ~ \.php$ {
        try_files       $uri = 404;
        fastcgi_index   index.php;
        fastcgi_pass    unix:/run/php-fpm/php-fpm.sock;
        include         fastcgi.conf;
    }

    location ~ \.cgi$ {
        root            /usr/share/nagios/sbin;
        rewrite         ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
        fastcgi_param   AUTH_USER $remote_user;
        fastcgi_param   REMOTE_USER $remote_user;
        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        include         fastcgi.conf;
        fastcgi_pass    unix:/run/fcgiwrap.sock;
    }

    location /stylesheets {
        alias /usr/share/nagios/share/stylesheets;
    }
}
nginx
  • 1 1 个回答
  • 1690 Views

1 个回答

  • Voted
  1. Best Answer
    Skamasle
    2014-12-21T14:13:19+08:002014-12-21T14:13:19+08:00

    也许 nagios 会因为某些配置而在 /nagios/images 上查找图像。检查页面(Ctrl+ u)的源代码以确认。

    你可以为 nagios 做一个别名:

    location /nagios {
            alias /usr/share/nagios/share;
        }
    

    还要检查配置文件cgi.cfg。

    (对不起我的英语不好)


    在带有 nginx 的 nagios 上的 freebsd 中,我将此配置用于 php/CGI,也许这可以帮助您解决 cgi 问题:

        location ~ ^/nagios/.+\.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME    $document_root$fastcgi_script_name;
            fastcgi_param QUERY_STRING       $query_string;
            include fastcgi_params;
        }
    
        location ~ ^/nagios/.+\.cgi$ {
            fastcgi_pass unix:/var/run/fcgiwrap/nagios.socket;
    #        fastcgi_pass 127.0.0.1:9000;
            fastcgi_param AUTH_USER "nagiosadmin";
            fastcgi_param REMOTE_USER "nagiosadmin";
            fastcgi_param SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    
            include fastcgi_params;
        }
    
    • 3

相关问题

  • 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