Docker Nginx部署

1.下载nginx镜像
docker pull nginx
2.创建nginx配置文件
vim /etc/nginx/nginx.conf
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http{
    upstream test.com {  
    server 118.184.66.215:8080;  
    }
    
    server {
            location / {
                 proxy_pass http://test.com;     
            }
    }
}

 

3.启动容器
docker run -d -p 80:80 -v /etc/nginx/nginx.conf:/etc/nginx/nginx.conf docker.io/nginx
posted @ 2018-01-09 16:44  陶海军  阅读(114)  评论(0编辑  收藏  举报