docker部署vue router history HTML5 模式

构建容器

nginx 配置 default.conf

powershell 复制代码
server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    access_log  /var/log/nginx/host.access.log  main;
    error_log  /var/log/nginx/error.log  error;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

Dockerfile

powershell 复制代码
FROM nginx:latest
COPY default.conf /etc/nginx/conf.d/default.conf
powershell 复制代码
docker build -t oavue:1.0 .

docker compose

powershellversion: 复制代码
services:
  oa-history-web:
      image: oavue:1.0
      container_name: oa-history-web
      ports:
        - 1180:80
      volumes:
        - /home/iiip603/docker/oa/html/dist:/usr/share/nginx/html
相关推荐
vortex56 分钟前
Container Desktop 安装与配置指南
docker
江湖有缘2 小时前
5款开源wiki知识库工具,支持Docker快速部署!
docker·容器·开源
jingchao19984 小时前
Cannot read properties of null (reading ‘insertBefore‘)
前端·javascript·vue.js
云上飞476369624 小时前
Windows WSL2 + Docker 环境下NVIDIA PhysicsNeMo 安装指南
windows·docker·physicsai·physicsnemo
抓不住时间的沙4 小时前
N1搭建Hexo个人博客,部署到Github
python·docker·node.js·debian·github·arm
wsad05325 小时前
CentOS 10 上使用 Docker Compose 部署 Discuz X5.0 论坛完整教程
linux·docker·centos·discuz
BTU_YC16 小时前
Docker Compose 部署 DozerDB 完整教程
运维·docker·容器
spencer_tseng19 小时前
[kylin & linux] install docker
linux·docker·kylin
猫不易20 小时前
从 Virtual DOM 到 Vapor:Vue 3.6 的另一条路
前端·vue.js
airobotcn20 小时前
智能巡检平台容器化部署:Docker+K8s在工业边缘的实践
人工智能·docker·容器·kubernetes·机器人·自动化