nginx 简单负载和反向代理

来源:互联网 发布:java数组转字符串 编辑:程序博客网 时间:2024/05/17 03:30
    log_format access_log_download  '$host $remote_addr - $remote_user [$time_local] $request '
        '"$status" $body_bytes_sent "$http_referer" '
        '"$http_user_agent" "$http_x_forwarded_for" $request_time $http_range';


upstream proxy_backend {
#       server 172.16.114.54  max_fails=2 fail_timeout=60s ; #weight=2
#       server 172.16.15.34  max_fails=2 fail_timeout=60s ; #weight=2
#       server 172.16.225.27  max_fails=2 fail_timeout=60s ; #weight=2
        server 1.1.1.1  max_fails=2 fail_timeout=60s ; #weight=2
}


server {
        listen       80;

        server_name

le123.cn

          


        index index.html index.htm index.php;
        root  /dat3/wwwroot/data;






        set_real_ip_from 100.0.0.0/8;


        proxy_buffering off;    #注意:如果开起来,就会把文件下载下下缓存buffer配置的目录下,流量进来的就会比出去的流量大


        real_ip_header     X-Forwarded-For;


        try_files $uri $uri/ @d4down_sync;


        location @d4down_sync {
                proxy_set_header Host d4.xxxx.cn;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                #proxy_pass http://1.1.1.1;
                proxy_pass http://proxy_backend;
                access_log /data0/logs/xx.xxxxxxx.com.log access_log_download;
        }
        access_log /data0/logs/d4down.xxxx.com_nomiss.log;


}
原创粉丝点击