我能够在启用 SSL 的情况下成功地获得在本地运行的 NGINX 反向代理。但是,一旦我尝试让它在 Docker 容器上运行,我就会遇到 SSL 问题。
我使用 .portforwarded 到端口 9443 docker run -it nginxProxy -v local_path_to_certs:container_path_to_certs -p 9443:443。
我的 Dockerfile:
FROM nginx:alpine
# Expost port 443
EXPOSE 443
RUN rm -v /etc/nginx/nginx.conf
RUN rm -rf /etc/nginx/conf.d
# Copy custom configuration file from the current directory
COPY nginx.conf /etc/nginx/nginx.conf
ENTRYPOINT [ "nginx", "-c", "/etc/nginx/nginx.conf", "-g", "daemon off;"]
Run Code Online (Sandbox Code Playgroud)
我的 nginx.conf:
events {
worker_connections 1024;
}
http {
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4:!SHA:!SHA1:!SSLv2:@STRENGTH;
ssl_prefer_server_ciphers on; …Run Code Online (Sandbox Code Playgroud)