当前位置: 首页 > news >正文

网站不被百度收录网站域名dns

网站不被百度收录,网站域名dns,福州公司做网站,王府井百货网上商城项目背景#xff1a;这是一个SpringBootvue3的项目#xff0c;通过maven打包后#xff0c;需要在Linux服务器上部署#xff0c;本篇博客主要记录docker-compose.yaml文件的含义#xff1a; docker-compose.yml 文件中定义了一个 algorithm_platform_frontend 容器#…项目背景这是一个SpringBootvue3的项目通过maven打包后需要在Linux服务器上部署本篇博客主要记录docker-compose.yaml文件的含义 docker-compose.yml 文件中定义了一个 algorithm_platform_frontend 容器该容器基于 nginx:latest 镜像并通过数据卷 (volumes) 绑定了 前端静态文件 和 Nginx 配置文件。下面详细解析各个参数的作用以及 :z 选项的含义。 1. docker-compose.yml 解析 algorithm_platform_frontend:image: nginx:latestcontainer_name: algorithm_platform_frontendhostname: algorithm_platform_frontendrestart: unless-stoppedvolumes:- ./frontend/html:/usr/share/nginx/html:z- ./frontend/nginx.conf:/etc/nginx/nginx.conf:zports:- 8000:80networks:- algorithm_platform_network参数解析 参数作用image: nginx:latest使用官方 nginx 最新版镜像container_name: algorithm_platform_frontend指定容器名称方便管理hostname: algorithm_platform_frontend设置容器的主机名restart: unless-stopped容器异常退出时自动重启但如果手动停止则不会重启volumes挂载数据卷绑定前端文件和 Nginx 配置文件ports映射端口宿主机 8000 - 容器 80外部访问 http://localhost:8000networks指定容器加入 algorithm_platform_network 网络 2. volumes 详解 volumes:- ./frontend/html:/usr/share/nginx/html:z- ./frontend/nginx.conf:/etc/nginx/nginx.conf:z挂载的路径 ./frontend/html:/usr/share/nginx/html:z 作用将宿主机 ./frontend/html 目录即前端 HTML 代码挂载到 Nginx 的 /usr/share/nginx/html使 Nginx 直接读取宿主机的静态资源。效果修改 ./frontend/html 里的文件后Nginx 自动加载更新无需重新构建镜像。 ./frontend/nginx.conf:/etc/nginx/nginx.conf:z 作用将 nginx.conf 配置文件挂载到容器的 /etc/nginx/nginx.conf自定义 Nginx 配置。 3. :z 选项的作用 在 volumes 挂载路径的末尾:z 选项是 SELinux 相关的设置适用于启用了 SELinux如 CentOS、RHEL的环境。 :z 的作用 改变 SELinux 上的标签让容器能访问宿主机文件。SELinux 默认会阻止 Docker 访问 非 docker 目录的文件:z 选项会自动添加 共享访问权限。 是否需要 :z 如果使用 CentOS / RHEL而且 SELinux 开启那么需要 :z 选项。如果是 Ubuntu / Debian / macOS / Windows则不需要 :z可以去掉。 示例去掉 :z volumes:- ./frontend/html:/usr/share/nginx/html- ./frontend/nginx.conf:/etc/nginx/nginx.conf如果你的环境 没有 SELinux可以去掉 :z避免不必要的权限修改。 4. 启动容器 启动 docker-compose docker-compose up -d-d后台运行容器访问 http://localhost:8000应该能看到你的前端页面 查看运行状态 docker ps查看日志 docker logs -f algorithm_platform_frontend更新配置后重启 如果修改了 nginx.conf 或 html 文件 docker restart algorithm_platform_frontend5. 总结 这个 docker-compose.yml 文件创建了一个 nginx 容器负责运行前端静态页面。挂载数据卷 html 目录提供前端代码nginx.conf自定义 Nginx 配置 :z 选项用于 SELinux 权限管理非 SELinux 环境可以去掉。端口映射 8000:80让外部可以通过 http://localhost:8000 访问前端。 建议 确保 ./frontend/html 目录存在否则 Nginx 可能无法启动。如果 nginx.conf 有错误可以进入容器调试docker exec -it algorithm_platform_frontend /bin/sh cat /etc/nginx/nginx.conf nginx -t # 测试 Nginx 配置是否正确如果你有更具体的问题欢迎找博主讨论
http://www.hkea.cn/news/14428374/

相关文章:

  • 山东中讯网站建设宁波网站建设制作公司排名
  • 深圳做网站公司网站 建设 成品
  • 免费视频网站app使用排名网站开发环境配置
  • 渭南 网站集约化建设标书制作难吗
  • 淘宝客网站跳转单品成都各公司网站
  • 丰宁县建设局网站WordPress标题美化
  • 重庆微信网站制作价格学计算机的毕业后可以找什么工作
  • 合肥市网站建设国外网站 dns
  • 网站效果图制作新手用什么程序建网站
  • 什么网站做论坛签名wordpress展示模板
  • 网站js特效免费网页小游戏
  • 二级域名网站建设跨国网站怎么做
  • 手机看黄山网站电脑网站打不开什么原因
  • 做影视后期应该关注哪些网站wordpress商店网页
  • 电子商务网站建设与管理的书企业集团网站源码
  • 商务网站建设网站英文域名是什么
  • 网站 水印可以做夫妻的游戏视频网站
  • jsp网站模版网站搜索工具
  • 建设一个门户网站需要多少钱广州网络推广
  • 小程序 网站 开发做属于自己公司的网站
  • 做网站实验体会开发网站的项目背景描述
  • 经开区网站建设外贸怎样做网站
  • 太原网站建设技术外包注册域名之后怎么使用
  • 网站大图片优化网站三合一建设
  • 江门网站排名优化seo软件推广哪个好
  • html5导航网站如何建设个人网站凡科怎么样
  • 中国煤炭建设协网站奉贤做网站建设
  • 建设银行网络学习网站青岛网上注册公司官网
  • 天津哪里做网站网站建设的培训的感受
  • 网站分析对比策划案网站