【发布时间】:2021-12-13 14:40:01
【问题描述】:
我正在尝试使用 nginx 映像通过 Docker 运行 UI 应用程序,我可以毫无问题地访问端口 80 上的服务,但是每当我尝试通过 443 端口上的 https 访问它时,我都无法访问应用程序站点不断加载并最终导致无法访问我已更新 default.conf 中的 nginx.conf 文件以允许通过端口 443 进行访问
下面是我的 nginx.conf
charset utf-8;
server {
listen 80;
server_name localhost;
root /usr/nginx/html;
}
server {
listen 443;
server_name localhost;
root /usr/nginx/html;
}
我在 /usr/nginx 文件夹中添加了 SSL 自签名证书,并通过 Dockerfile 暴露了 443 端口
以下是我的 Dockerfile
FROM nginx
COPY dist /usr/nginx/html
RUN chmod -R 777 /usr/nginx/html/*
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY domain.crt /usr/nginx
EXPOSE 80:443
ENTRYPOINT nginx -g 'daemon off;'
谁能解释一下443端口不允许任何访问
【问题讨论】: