2017-03-17 118 views
1

我已經安裝了openvas9並且已經從cert store安裝了證書。我曾嘗試使用nginx作爲反向代理。我的openvas設置是/etc/default/openvas-gsa,看起來像這樣;Openvas9的Nginx代理

# 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 

/etc/nginx/sites-enabled/openvas我的nginx的配置看起來像這樣(用改變明顯的服務器名稱);

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。我哪裏錯了?

回答

0
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