nginx的web反向代理配置

下面是Nginx的web反向代理的配置。

以下是保守配置,大部分情况下可以将值加大,比如在http段里添加:
server_names_hash_bucket_size 256;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;

以减少502出现的情况等。
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 0;
access_log off;
#gzip on;

limit_zone one $binary_remote_addr 10m;

server {
listen 80 default;
limit_conn one 5;
#limit_rate 10k;
server_name localhost;
location / {
proxy_pass http://***.***.***.***:80;
client_max_body_size 100m;
proxy_redirect off;

proxy_buffer_size 256k;
proxy_buffers 4 256k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
keepalive_timeout 0;

}
}

upstream im286 {
server ***.***.***.***:80
}
}

This entry was posted in Nginx and tagged , , . Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>