简体   繁体   English

使用 NGINX 将 /openvas/ 重定向到 OpenVAS 扫描仪

[英]Redirect /openvas/ to OpenVAS Scanner with NGINX

I'm trying to make my OpenVAS Scanner available via path in nginx. So I tried我正在尝试通过 nginx 中的路径使我的 OpenVAS 扫描仪可用。所以我尝试了

location /openvas/ {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;}

thats not working, it gives a blank page那是行不通的,它给出了一个空白页

When I change it to root当我将其更改为 root 时

location / {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; }

its working它的工作

when checking nginx logfiles it seems it gets the first page, but not the other files requested检查 nginx 日志文件时,它似乎获得了第一页,但没有获得请求的其他文件

"GET /openvas/ HTTP/2.0" 200
"GET /config.js HTTP/2.0" 404

I have checked the docker container image and just proxying the traffic trough NGINX will not work.我已经检查了 docker 容器镜像,仅代理流量槽 NGINX 是行不通的。 You have to set the Public Hostname for your OpenVAS instance as well to tell OpenVAS how to server static files and build directories in the frontend.您还必须为您的 OpenVAS 实例设置公共主机名,以告诉 OpenVAS 如何服务器 static 文件并在前端构建目录。

I have found this on docker hub.我在 docker 集线器上找到了这个。

docker run -d -p 443:443 -e PUBLIC_HOSTNAME=myopenvas.example.org --name openvas mikesplain/openvas

In your case you should set the PUBLIC_HOSTNAME to example.com/openvas/ .在您的情况下,您应该将PUBLIC_HOSTNAME设置为example.com/openvas/ This will tell OpenVAS public domain used to access the application.这将告诉 OpenVAS 用于访问应用程序的公共域。

Your NGINX configuration will be您的 NGINX 配置将是

location /openvas/ {
  proxy_pass http://127.0.0.1:8080/;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM