# http协议虚拟主机的配置文件模板 # vim /usr/local/nginx/conf/vhosts/test.com.conf upstream test.com { server 1.1.1.1:81 max_fails=3 fail_timeout=60s; server 2.2.2.2:81 max_fails=3 fail_timeout=60s; ip_hash; } server { listen 80; server_name test.com; location / { root html; index index.html index.htm; proxy_pass http://test.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; access_log /data0/log/nginx/test.com.log nginx_log; } }
原文地址:http://wupengfei.blog.51cto.com/7174803/1958141