nginx 配置文件


user www;
worker_processes 4;


events {
use epoll;
worker_connections 90240;
}


http {
include mime.types;
default_type application/octet-stream;

log_format main '$host request_time= "$request_time" remote_addr= "$remote_addr" http_x_forwarded_for= "$http_x_forwarded_for" $remote_user [$time_local] "$request" '
'$status body_bytes_send= "$body_bytes_sent" bytes_sent= "$bytes_sent" "$http_referer" '
'"$http_user_agent"';


client_max_body_size 50m;
client_header_timeout 10s; #default 1m
client_body_timeout 10s; #default 1m
send_timeout 10s; #default 1m
keepalive_timeout 90s; #default 90s
keepalive_requests 1000; #default 1000

client_body_buffer_size 5120k;
client_header_buffer_size 640k;
proxy_http_version 1.1;
# proxy_set_header Connection "";
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_buffer_size 1280k;
proxy_buffers 16 2560k;
proxy_busy_buffers_size 5120k;
proxy_temp_file_write_size 1024m;
proxy_ignore_client_abort on;
proxy_headers_hash_max_size 1024;
proxy_headers_hash_bucket_size 128;
proxy_temp_path /dev/shm/temp/temp_dir;
proxy_cache_path /dev/shm/temp/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=300m;
sendfile on;
#tcp_nopush on;
server_names_hash_bucket_size 128;

#keepalive_timeout 0;

#limit_req_zone $cookie_call $limiturl zone=reqsingle:20m rate=50r/s; #default 50
limit_rate 400k;
#limit_conn perip 50;
#limit_conn perserver 150;


server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
return 401;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ .php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}


gzip on;
gzip_proxied any;
gzip_comp_level 8;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 1k;
gzip_vary on;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/swf image/jpg;


limit_conn_zone $binary_remote_addr zone=limit:15m;
limit_req_zone $binary_remote_addr zone=allips:15m rate=40r/s;

upstream legao {
server 110.92.64.169:80 max_fails=1 fail_timeout=11;
}
upstream legaowap {
server 110.92.64.169:80 max_fails=1 fail_timeout=11;
}
upstream legaos {
server 110.92.64.169:443 max_fails=1 fail_timeout=11;
}
upstream legaowaps {
server 110.92.64.169:443 max_fails=1 fail_timeout=11;
}


include system/lg/*.conf;
include /etc/nginx/vhost-159-11/*.conf;
#include system/shangwu/*.conf;
}

原文地址:https://www.cnblogs.com/iantest/p/14040583.html