Nginx proxy_pass 反向代理

Standard

vi conf/nginx.conf
http{


include vhosts/yemaosheng_com/*.conf;
}

vi conf/vhosts/yemaosheng_com/www.conf

upstream  www_yemaosheng_com  {
  ip_hash;
  server   202.0.0.1:80;
  server   202.0.0.2:80;
  server   202.0.0.3:80;
}
server {
  listen 80;
  server_name www.yemaosheng.com;
  access_log  off;
  location / {
    proxy_pass http://www_yemaosheng_com
    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;
    client_max_body_size 50m;
    client_body_buffer_size 256k;
    proxy_connect_timeout 30;
    proxy_send_timeout 30;
    proxy_read_timeout 60;
    proxy_buffer_size 16k;
    proxy_buffers 4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;
  }
  # deny access to .htaccess files
  location ~ /\.ht {
    deny  all;
  }
}

3 thoughts on “Nginx proxy_pass 反向代理

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.