1. 本地需要安装docker desktop
2. 服务器上需要安装docker
Dockerfile文件:
# 设置基础镜像
FROM nginx
# 定义作者
MAINTAINER xxx<xxx@qq.com>
# 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面
COPY dist/ /usr/share/nginx/html/
#用本地的 default.conf 配置来替换nginx镜像里的默认配置
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
nginx/default.conf :
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;
}
# location /basic-api {
# rewrite ^/basic-api/(.*)$ /$1 break;
# proxy_pass http://xxxx;
# }
# 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 {