微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

尝试将 docker autodeploy 设置到我的服务器但是 nginx 图像没有显示应用程序

如何解决尝试将 docker autodeploy 设置到我的服务器但是 nginx 图像没有显示应用程序

我创建了以下 docker 镜像

# Stage 0,"build-stage",based on Node.js,to build and compile the frontend
FROM tianGolo/node-frontend:10 as build-stage
workdir /app
copY package*.json /app/
RUN npm install
copY ./ /app/
RUN CI=true npm test
RUN npm run build
# Stage 1,based on Nginx,to have only the compiled app,ready for production with Nginx
FROM Nginx:1.15
copY --from=build-stage /app/build/ /usr/share/Nginx/html
# copy the default Nginx.conf provided by tianGolo/node-frontend
copY ./Nginx.conf /etc/Nginx/conf.d/v2.myapp.io

Nginx.conf 在哪里

server {
  listen 80;
  server_name serverip v2.myapp.io www.v2.myapp.io;
  location / {
    root /usr/share/Nginx/html;
    index index.html index.htm;
    try_files $uri $uri/ /index.html =404;
  }

  include /etc/Nginx/extra-conf.d/*.conf;
}

然后我执行以下 sh

docker build -t mycontainer .
docker push mycontainer:latest
ssh root@ip 'docker pull mycontainer:latest' 
ssh root@ip 'docker stop mycontainer'
ssh root@ip 'docker rm mycontainer'
ssh root@ip 'sudo docker run -p 8080:80 -it -d --name mycontainer  mycontainer'

它工作正常,但地址 v2.myapp.io 指向一个空白的 Nginx 页面,所以我想我有某种配置错误。但我不确定还会发生什么

有人可以帮忙解决这个问题吗?

我记得当我过去手动完成所有这些时,我有一个启用站点文件夹和一个可用的站点文件夹,我尝试创建它们并将 Nginx.conf 文件放入但我没有运气

那里出了什么问题?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。