网站更新AAF后,www站点Server(IIS)负载不停的攀升,从当初的平均30%攀升到70%;CPU一直保持这么高的负载,会有问题的;便开始尝试用Nginx来挂在IIS服务器前面,来降低IIS服务器负载;
user daemon daemon;
worker_processes 8;
error_log /usr/local/nginx/logs/nginx_error.log crit;
pid /var/run/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
http
{
include mime.types;
default_type application/octet-stream;
charset utf-8;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 300m;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
client_body_buffer_size 512k;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
upstream myproject {
server x.x.x.x weight=3;
}
server {
listen 80;
server_name www.xxxx.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://myproject;
}
}
server {
listen 80;
server_name xxxx.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://myproject;
}
}
server
{
listen 80;
server_name x.x.x.x;
location /Nginxstatus {
stub_status on;
access_log off;
auth_basic “NginxStatus”;
#auth_basic_user_file htpasswd;
}
}
}