vim /usr/local/nginx/conf/vhosts/lb.conf (创建一个Nginx配置文件)
upstream bbs.aaa.cn{
server 1.2.3.1:80;
server 1.2.3.4:80;
}
server {
listen 80;
server_name bbs.aaa.cn;
location / {
proxy_pass http://bbs.aaa.cn/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# access_log /home/logs/bbs.access combined;
}
upstream blog.aaa.cn{
server 1.2.3.1:80;
server 1.2.3.4:80;
}
server {
listen 80;
server_name blog.aaa.cn;
location / {
proxy_pass http://blog.aaa.cn/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# access_log /home/logs/ss.access combined;
}