疑问:关于nginx作为下载服务器的负载均衡配置
以下是我nginx的配置信息:upstream down_xyz_com_cn {
server down.1.xyz.com.cn;
# server down.2.xyz.com.cn;
}
server{
listen 80;
server_name down.xyz.com.cn;
access_log /mnt/logs/down/down.log;
location /{
proxy_pass http://down_xyz_com_cn;
}
}
server{
listen 80;
server_name down.1.xyz.com.cn;
access_log /mnt/logs/down.1/down.1.log;
location /{
root /mnt/programs/resource/;
}
}
问题是,我用down.1.xyz.com.cn/res/a.jpg可以访问,为什么down.xyz.com.cn/res/a.jpg不能访问呢?
那用nginx做负载均衡的下载服务器该怎么配置? --------------------编程问答-------------------- 没人知道吗? --------------------编程问答-------------------- --------------------编程问答--------------------
upstream backend
{ server 192.168.1.102:8080;
server 192.168.1.103:8080;
server 192.168.1.105:8080;
}
server {
listen 80;
server_name www.yuhongchun027.com;
location / {
root /var/www ;
index index.jsp index.htm index.html;
proxy_redirect off;
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_pass http://backend; }
}
补充:Java , Web 开发