nginx 反向代理后台转发 配置


#user  nobody;

worker_processes  4;



#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;



#pid        logs/nginx.pid;





events {

    worker_connections  10240;

}





http {

    include       mime.types;

    default_type  application/octet-stream;

sendfile on;

    keepalive_timeout 65;

    gzip on;

    client_max_body_size 50m; #缓冲区代理缓冲用户端请求的最大字节数,可以理解为保存到本地再传给用户

    client_body_buffer_size 256k;

    client_header_timeout 3m;

    client_body_timeout 3m;

    send_timeout 3m;

    proxy_connect_timeout 300s; #nginx跟后端服务器连接超时时间(代理连接超时)

    proxy_read_timeout 300s; #连接成功后,后端服务器响应时间(代理接收超时)

    proxy_send_timeout 300s;

    proxy_buffer_size 64k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小

    proxy_buffers 4 32k; #proxy_buffers缓冲区,网页平均在32k以下的话,这样设置

    proxy_busy_buffers_size 64k; #高负荷下缓冲大小(proxy_buffers*2)

    proxy_temp_file_write_size 64k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传递请求,而不缓冲到磁盘

    proxy_ignore_client_abort on; #不允许代理端主动关闭连接

server_names_hash_bucket_size 512;



#10服务器开始_______________________________________

upstream server_9.10 {

    server 192.168.9.10;

}

 

server

{

    listen 80; 

     



    server_name www.baidu.com baidu.com  www.xx.com xx.com;

    location  /  {

        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://server_9.10;



    }



    access_log logs/91.10.log;



}

#10服务器end______________________



#9系统服务器开始___________________________

upstream server_9.9 {

    server 192.168.9.9;



}

 

server

{

    listen 80;

    server_name www.1232.com 123.com;

    location / {

        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://server_9.9;

    }

    access_log logs/9.9.log;

}

#9服务器end______________________________________





}

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容