【docker】docker安装nginx
1、docker hub
https://hub.docker.com/_/nginx
2、安装
默认配置安装
docker run --name nginx -d nginx
指定端口安装
docker run --name nginx -d -p 8080:80 nginx
文件映射主机安装
#mkdir -p $HOME/Tools/{html,conf,logs} #touch nginx.conf docker run -d \ --name nginx \ -m 200m \ -p 8080:80 \ -v $HOME/Tools/nginx/nginx.conf:/etc/nginx/nginx.conf \ -v $HOME/Tools/nginx/logs:/var/log/nginx \ -v $HOME/Tools/nginx/html:/usr/share/nginx/html \ -v $HOME/Tools/nginx/conf:/etc/nginx/conf.d \ -e TZ=Asia/Shanghai \ --privileged=true \ nginx
3、访问测试
Then you can hit http://localhost:8080
or http://host-ip:8080
in your browser
参考链接:
https://blog.csdn.net/weixin_46244732/article/details/114315708