美文网首页
三、Docker安装nginx

三、Docker安装nginx

作者: 我爱福尔摩斯呀 | 来源:发表于2021-03-19 11:21 被阅读0次

1、搜索nginx镜像

docker search nginx

2、拉取镜像

docker pull nginx

3、运行镜像

docker run --name nginx -d -p 80:80 --restart=always --privileged=true -v /gqy/nginx/conf.d:/etc/nginx/conf.d -v /gqy/nginx/html:/usr/share/nginx/html -v /gqy/nginx/log:/var/log/nginx nginx:gqy


-d 交互运行
-p 端口映射
--v 容器挂载
--name 容器名称
image.png

4、如果报错* is forbidden

[error] 8#8: *3 directory index of "/usr/share/nginx/html/" is *forbidden*, client: 172.16.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8104"

在docker中修改

cd /usr/share/nginx/html
chown nginx:nginx ./*

相关文章

网友评论

      本文标题:三、Docker安装nginx

      本文链接:https://www.haomeiwen.com/subject/phkpcltx.html