我为netbox-docker映像创建了反向代理。它是SSL的自定义反向代理,但是当我启动SSL时,容器的docker日志在崩溃时会这样说:
Docker镜像和教程,我在这里看到:https://github.com/netbox-community/netbox-docker/blob/release/README.md
[emerg] 1#1: host not found in upstream "netbox" in /etc/nginx/conf.d/proxy_ssl.conf:27
netbox容器的Ma nginx配置在这里:
daemon off;
worker_processes 1;
error_log /dev/stderr info;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
server_tokens off;
client_max_body_size 10M;
server {
listen 8080;
access_log off;
location /static/ {
alias /opt/netbox/netbox/static/;
}
location / {
proxy_pass http://netbox:8001;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
}
和用于反向代理的nginx在这里:
server {
listen 8000;
listen [::]:8000;
server_name domain.tld;
return 301 https://$host$request_uri;
}
server {
listen 8443 ssl http2;
listen [::]:8443 ssl http2;
server_name domain.tld;
location /static/ {
alias /opt/netbox/netbox/static/;
}
location / {
#proxy_set_header X-Real-IP $remote_addr;
#proxy_buffering off;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_pass http://netbox:8001/;
}
ssl_certificate /etc/nginx/conf.d/domain.crt;
ssl_certificate_key /etc/nginx/conf.d/domain.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
}
答案 0 :(得分:0)
已解决。我不得不将domain.tld
放入proxy_pass
的URL中,因为docker容器位于同一docker网络上,所以可能是这样。