分类标签归档:nginx

前端包docker部署


1,首先得有docker环境,没有的参考我以前的记录

1,创建Dockerfile

touch Dockerfile

vim  Dockerfile

2.写入以下内容

FROM nginx:latest
COPY ./dist /usr/share/nginx/html/
COPY ./default.conf /etc/nginx/conf.d/
EXPOSE 80

意思是使用nginx镜像部署, 把当前路径./dist(前端打包后的静态文件) 拷贝至容器/usr/share/nginx/html/ 把当前路径./default.conf的配置文件拷贝至容器/etc/nginx/conf

查看详情

docker 配置nginx和myslq


nginx

docker run -p 8080:80 --name nginx --restart=always \
-v /opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /opt/nginx/conf.d:/etc/nginx/conf.d \
-v /opt/nginx/html:/usr/share/nginx/html \
-v /opt/nginx/logs:/var/log/nginx \
-d  nginx

或者

docker run \
--name my_nginx \
-v /opt/nginx/log:/va

查看详情