[英]Docker nginx connection refused (port 80 and 443) when using corporate signed certificate
我在 docker 环境中运行 nginx 作为反向代理。 以下是用于创建实例的 Dockerfile。
FROM nginx:1.18.0
ENV https_proxy=http://someproxy.nt.gov.au:8080
ENV http_proxy=http://someproxy.nt.gov.au:8080
RUN env
COPY nginx.conf /etc/nginx/nginx.conf
COPY server-chain.cert /etc/nginx/server.cert
COPY server-chain.key /etc/nginx/server.key
COPY /html /usr/share/nginx/html
RUN echo 'alias ll="ls -la"' >> ~/.bashrc
EXPOSE 80
EXPOSE 443
STOPSIGNAL SIGQUIT
CMD ["nginx", "-g", "daemon off;"]
以下是 nginx.conf 文件的上游指令和服务器 {} 部分 - 默认为 rest
upstream cics-liberty {
server some-app-server:3000 ;
}
和
server {
listen 80;
listen 443 ssl;
listen [::]:80;
server_name localhost;
ssl_certificate server.cert;
ssl_certificate_key server.key;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /offtocics/ {
proxy_pass http://cics-liberty ;
}
location /barcode/ {
proxy_pass http://cics-liberty ;
}
location /birt_wlp_s1/ {
proxy_pass http://cics-liberty ;
}
location /scope2/ {
proxy_pass http://cics-liberty ;
}
...
}
用于实例化服务器的 docker 命令是
docker run -it --name webserver -d -p 8047:80 -p 8046:443 webserver:0.1
我正在运行其中 2 个实例,一个使用自签名证书。 另一个有一个由我们公司 CA 签名的证书包。
使用自签名证书的服务器按预期运行。 使用公司 CA 签署的证书的服务器拒绝http 和 https端口上的连接。
两者的日志记录 output 是相同的,除了服务器拒绝连接在访问日志中没有任何内容。 看起来它甚至在它到达网络服务器之前就被拒绝了。
docker 环境在其内部虚拟网络中没有任何防火墙
我已经用自签名证书重建了失败的网络服务器,它按预期工作。
这是我的配置错误。 我将证书包从 PCKS7 重新格式化为 PEM 格式,但是我没有解密相关的私钥。
一旦我安装了私钥的解密版本-一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.