1

我已经安装了 openvas9 并从证书商店安装了证书。然后我尝试使用 nginx 作为反向代理。我的 openvas 设置/etc/default/openvas-gsa如下所示;

# Defaults for Greenbone Security Assistant initscript
# sourced by /etc/init.d/openvas-gsa
# installed at /etc/default/openvas-gsa by the maintainer scripts

# To disable HTTPS:
#
#HTTP_ONLY=1

# To enable http redirection:
#
HTTP_REDIRECT=1

# To set listening address:
# 
#LISTEN_ADDRESS="0.0.0.0"

# To set listening port number:
#
PORT_NUMBER=4000

我的 nginx 配置/etc/nginx/sites-enabled/openvas看起来像这样(显然更改了服务器名称);

server {
    listen 443 ssl;
    server_name vas.server.com;

    location / {
        proxy_set_header   Host             $http_host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   REMOTE_HOST      $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header   X-FORWARDED-PROTOCOL $scheme;
        proxy_pass http://localhost:4000;
    }
}

我得到的只是一个502 Bad Gateway. 我哪里错了?

4

1 回答 1

1
server {
       listen         80;
       server_name    vas.novarumcloud.com;
       return         301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name vas.novarumcloud.com;

    location / {
        proxy_set_header   Host             $http_host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   REMOTE_HOST      $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header   X-FORWARDED-PROTOCOL $scheme;  
        proxy_pass https://localhost:4000;
    }
}

但是,您还需要进行/etc/default/openvas-gsa 如下设置;

# Defaults for Greenbone Security Assistant initscript
# sourced by /etc/init.d/openvas-gsa
# installed at /etc/default/openvas-gsa by the maintainer scripts

# To disable HTTPS:
#
#HTTP_ONLY=1

# To enable http redirection:
#
HTTP_REDIRECT=1

# To set listening address:
# 
#LISTEN_ADDRESS="0.0.0.0"

# To set listening port number:
#
PORT_NUMBER=4000
于 2017-04-20T07:03:40.990 回答