使用 nginx 的 Monitorix

使用 nginx 的 Monitorix

我有一个使用 nginx 和 jetty 为网站提供服务的 VPS,一切运行正常。该网站可通过我的 .com 域名访问。

我已经安装了 monitorix,我想访问 monitorix web 用户界面,它也应该由 nginx 提供服务(我不想只为 monitorix 安装 lighttpd 或 apache 等其他服务器)。monitorix 文档中说应该可以通过http://本地主机/monitorix。我尝试过 www.mydomain.com/monitorix,但它显示我的自定义 404 页面,我也尝试过访问http://本地主机/monitorix使用 curl 和 lynx 我同样得到了 404 页面。

如何配置 nginx 来为 monitorix WUI 提供服务?如果我将其配置为仅向 localhost 提供服务,则可以从我的计算机创建 SSH 隧道来查看页面和图形静态信息。

谢谢你!!

答案1

Nginx 不支持 CGI。你可以尝试简单CGI,但我建议为 Monitorix 安装 Apache。

答案2

您可以使用 fcgiwrap 从 NGINX 访问 Monitorix cgi 脚本。

    location /monitorix {
        alias /var/lib/monitorix/www/;
    }

    location /monitorix-cgi/ {
        alias /var/lib/monitorix/www/cgi/;
        include fastcgi_params;
        fastcgi_pass unix:/run/fcgiwrap.socket;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }

正如记录在案的常问问题Web 服务器需要在 imgs 目录中具有写权限:

chown -R www-data:www-data /var/lib/monitorix/www/imgs

相关内容