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
相关推荐
给月亮点灯|18 小时前
Vue基础知识-脚手架开发-初始化目录解析
前端·javascript·vue.js
哆啦A梦158818 小时前
Element-Plus
前端·vue.js·ts
毕设源码-郭学长20 小时前
【开题答辩全过程】以 基于vue在线考试系统的设计与实现为例,包含答辩的问题和答案
前端·javascript·vue.js
詩句☾⋆᭄南笙20 小时前
初识Vue
前端·javascript·vue.js
qb21 小时前
vue3.5.18-编译-生成ast树
前端·vue.js·架构
我的写法有点潮21 小时前
Vue实例都做了什么?
前端·javascript·vue.js
鹏多多21 小时前
vue3监听属性watch和watchEffect的详解
前端·javascript·vue.js
Dxy123931021621 小时前
Dockerfile文件常用配置详解
开发语言·docker
小蒜学长21 小时前
基于SpringBoot+Vue的健身房管理系统的设计与实现(代码+数据库+LW)
java·数据库·vue.js·spring boot·后端
不想上班只想要钱1 天前
vue3 ts:声明的一个数组不能将类型“boolean”分配给类型“never”。
前端·vue.js