默认安装了Docker @vue/cli 已有一个vue项目已有dist文件夹
1、在vue根目录下运行代码
docker pull nginx
2、项目根目录下创建nginx.conf.template
server {
listen 80;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
error_page 404 /index.html;
}
location /api {
proxy_pass http://${API};//环境变量,项目中接口动态配置