docker 安装及配置 nginx
2019-01-05 20:55
405 查看
端口映射
[code]docker run -d -p 8000:80 --name nginx nginx
-p 8000:80将容器中的80端口映射到linux虚拟机中的8000端口
安装成功如图
射到容器外映
[code]docker run -d -p 8000:80 --name nginx -v /home/html/:/usr/share/nginx/html nginx
-v /home/html/:/usr/share/nginx/html将容器的/usr/share/nginx/html映射到虚拟机中的/home/html/
映射配置文件
[code]docker run -d -p 8000:80 --name nginx -v /home/nginx.conf:/etc/nginx/nginx.conf nginx
[code]docker run -d -p 8000:80 -p 8090:8090 --name nginx -v /home/nginx.conf:/etc/nginx/nginx.conf nginx
nginx.conf文件如下
[code]user root; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; server { listen 8090; server_name localhost:8090; location / { proxy_pass http://127.0.0.1:80; } } sendfile on; #tcp_nopush on; keepalive_timeout 65; autoindex on; #gzip on; include /etc/nginx/conf.d/*.conf; client_max_body_size 100M; client_header_buffer_size 128k; large_client_header_buffers 4 128k; }
相关文章推荐
- docker配置nginx并安装ssl证书
- Docker 安装 Nginx 并个性化挂载配置文件 nginx.conf
- CentOS安装和配置Docker和Nginx
- docker 安装nginx 配置udp
- docker安装nginx并配置通过https访问的方法
- Docker nginx安装与配置挂载的方法
- centos使用docker下安装mysql并配置、nginx
- Nginx安装及配置详解
- nginx php-fpm安装配置
- Docker实战之安装配置Hadoop-2.5.2完全分布式集群
- linux安装nginx并且配置负载均衡
- CentOS-6.3系统中安装配置Web服务器Nginx
- ubuntu16.10安装docker17.03.0-ce并配置国内源和加速器
- Debian系统下nginx的安装与配置
- ubuntu服务器上nginx安装及配置过程记录
- centos下nginx+postgresql+php+memcached+apc安装与配置
- nginx+fastcgi安装配置
- 服务器搭建:CentOS上安装配置nginx
- Nginx安装配置(系统平台:CentOS 7.1 64位)
- Nginx for Windows安装配置之解压缩版