日期:2014-05-17 浏览次数:20698 次
user www www; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; events { use epoll; worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; charset gb2312; sendfile on; tcp_nopush on; tcp_nodelay on; 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; #keepalive_timeout 0; keepalive_timeout 65; gzip on; gzip_min_length 1k; gzip_http_version 1.1; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; upstream tomcat_server { server 192.168.0.129:8080; } server { listen 80; server_name www.9uyou.com; index index.html index.htm index.jsp index.do default.jsp default.do; root /home/www; if ( -d $request_filename) { rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent; } location ~ \.(jsp|jspx|do)?$ { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://tomcat_server; } location ~ .*\.(gif|jpeg|jpg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 1h; } access_log off; } }