一: 安装容器
//下载镜像
docker pull nginx
运行镜像: default.conf是配置server块的地方,将其映射到本地方便修改
docker run -d -p 80:80 -p 3000:3000 --name nginx -v /usr/local/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf c89fa25e901e
二: 配置Nginx
宿主机内找到 /usr/local/nginx/conf.d/default.conf 文件,配置server块:
server {
listen 3000;
server_name 192.168.1.10;
location / {
root /usr/local/project/web/dist/;
index index.html;
}
}