step 1
docker pull nginx
step 2
make -p /etc/nginx/conf.d
step 3
vim enic.conf
copy如下配置,根据自己业务场景稍加改动即可。
upstream enic {
server 127.0.0.1:8090;
}
server {
listen 8000;
listen [::]:8000;
server_name enicdemo.com;
client_max_body_size 1024m;
location / {
proxy_pass http://enic;
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
step 4
docker run --name nginx --network=host -v /var/log/nginx:/var/log/nginx -v /etc/nginx/conf.d:/etc/nginx/conf.d -d nginx