worker_processes 8
;
error_log /usr/local/nginx/logs/error.log info
;
pid /usr/local/nginx/logs/nginx.pid
;
worker_rlimit_nofile 65535
;
events
{
use epoll
;
worker_connections 65535
;
keepalive_timeout 60
;
client_header_buffer_size 4k
;
open_file_cache max
=65535 inactive
=60s
;
open_file_cache_valid 80s
;
open_file_cache_min_uses 1
;
open_file_cache_errors on
;
}
http
{
include mime.types
;
default_type application/octet-stream
;
server_names_hash_bucket_size 128
;
client_header_buffer_size 32k
;
large_client_header_buffers 4 64k
;
client_max_body_size 8m
;
sendfile on
;
autoindex on
;
tcp_nopush on
;
tcp_nodelay on
;
keepalive_timeout 120
;
fastcgi_connect_timeout 300
;
fastcgi_send_timeout 300
;
fastcgi_read_timeout 300
;
fastcgi_buffer_size 64k
;
fastcgi_buffers 4 64k
;
fastcgi_busy_buffers_size 128k
;
fastcgi_temp_file_write_size 128k
;
gzip on
;
gzip_min_length 1k
;
gzip_buffers 4 16k
;
gzip_http_version 1.0
;
gzip_comp_level 2
;
gzip_types text/plain application/x-javascript text/css application/xml
;
gzip_vary on
;
upstream jh.w3cschool.cn
{
server 192.168.80.121:80 weight
=3
;
server 192.168.80.122:80 weight
=2
;
server 192.168.80.123:80 weight
=3
;
}
server
{
listen 80
;
server_name www.w3cschool.cn w3cschool.cn
;
index index.html index.htm index.php
;
root /data/www/w3cschool
;
location ~ .*.
(php
|php5
)?$
{
fastcgi_pass 127.0.0.1:9000
;
fastcgi_index index.php
;
include fastcgi.conf
;
}
location ~ .*.
(gif
|jpg
|jpeg
|png
|bmp
|swf
)$
{
expires 10d
;
}
location ~ .*.
(js
|css
)?$
{
expires 1h
;
}
log_format access
'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /usr/local/nginx/logs/host.access.log main
;
access_log /usr/local/nginx/logs/host.access.404.log log404
;
location /
{
proxy_pass http://127.0.0.1:88
;
proxy_redirect off
;
proxy_set_header X-Real-IP
$remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header Host
$host;
client_max_body_size 10m
;
client_body_buffer_size 128k
;
proxy_intercept_errors on
;
proxy_connect_timeout 90
;
proxy_send_timeout 90
;
proxy_read_timeout 90
;
proxy_buffer_size 4k
;
proxy_buffers 4 32k
;
proxy_busy_buffers_size 64k
;
proxy_temp_file_write_size 64k
;
}
location /NginxStatus
{
stub_status on
;
access_log on
;
auth_basic
"NginxStatus";
auth_basic_user_file confpasswd
;
}
location ~ .
(jsp
|jspx
|do
)?$
{
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://127.0.0.1:8080
;
}
location ~ .*.
(htm
|html
|gif
|jpg
|jpeg
|png
|bmp
|swf
|ioc
|rar|zip|txt
|flv
|mid
|doc
|ppt
|
pdf
|xls
|mp3
|wma
)$
{
expires 15d
;
}
location ~ .*.
(js
|css
)?$
{
expires 1h
;
}
}
}