Nginx for serving multiple sites in docker
發表於 : 2017-06-28 08:23:37
http://blog.nbellocam.me/2016/03/01/ngi ... es-docker/
docker
nginx
docker
代碼: 選擇全部
web:
restart: always
build: ./conf/
ports:
- "80:80"
volumes:
- /path/in/vm/www:/usr/share/nginx/html
external_links:
- wordpress_web_1:bloghost
代碼: 選擇全部
http {
#...
upstream wordpress {
server bloghost:80;
}
#...
server {
listen 80;
server_name blog.nbellocam.me;
location / {
proxy_pass http://wordpress/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
}
}