简体   繁体   中英

Redirect /openvas/ to OpenVAS Scanner with NGINX

I'm trying to make my OpenVAS Scanner available via path in nginx. So I tried

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

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

"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. 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.

I have found this on docker hub.

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/ . This will tell OpenVAS public domain used to access the application.

Your NGINX configuration will be

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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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