如何解决无法加载证书 "/etc/ssl/ServerCertificate.crt": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory
这是我的 docker 文件
# stage1 - build react app first
FROM node:12.16.1-alpine3.9 as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY ./package.json /app/
COPY ./package-lock.json /app/
RUN npm i --silent
COPY . /app
RUN npm run build
# stage 2 - build the final image and copy the react build files
FROM nginx:1.17.8-alpine
COPY --from=build /app/build /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/conf.d
COPY ServerCertificate.crt /etc/ssl/
COPY 2022pk.key /etc/ssl/
EXPOSE 443
CMD ["nginx","-g","daemon off;"]
这在 nginx.conf 文件中
server {
listen 443 ssl;
ssl_certificate /etc/ssl/ServerCertificate.crt;
ssl_certificate_key /etc/ssl/2022pk.key;
server_name *.com;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
# to redirect all the requests to index.html,# useful when you are using react-router
try_files $uri /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
我收到错误
无法加载证书 "/root/etc/ssl/ServerCertificate.crt": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/root/etc/ssl /ServerCertificate.crt','r') 错误:2006D080:BIO 例程:BIO_new_file:没有这样的文件)
解决方法
在 Expose 中添加了 80 端口并且成功了!!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。