user  nobody;

worker_processes  8;



#pid        logs/nginx.pid;



events {

    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;


#sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

gzip on;

sendfile        on;

    #keepalive_timeout  0;

    #keepalive_timeout  65;


    #gzip  on;

 upstream tomcat{

                server 10.251.236.220:8080 weight=1 max_fails=2 fail_timeout=30s;

ip_hash;

        }

 server {

listen     80;


server_name  www.518qylm.com;

# rewrite ^(.*)$ https://$host$1 permanent;

charset utf-8;

        access_log  logs/host.access.log  main;

        root  html/ROOT;

        location / {

proxy_pass http://tomcat;

proxy_redirect off;

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_set_header X-Forwarded-Proto  $scheme;

        client_max_body_size 10m;

        client_body_buffer_size 128k;

        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;

    index  ak47.html index.html index.htm;

}

 # 鍔ㄦ佽姹傜殑杞彂

      location ~ .*.jsp$ {

proxy_pass https://tomcat;

        proxy_set_header Host $host;

      }

        location ~ .*/.(gif|jpg|jpeg|png|bmp|swf|css|js)$ {                                      

expires      30d; 

}


}


server {

listen 443;

server_name localhost;

ssl on;

ssl_certificate server.pem;

ssl_certificate_key server.key;

ssl_session_timeout 5m;

ssl_protocols SSLv3 TLSv1;

ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;

ssl_prefer_server_ciphers on;

location / {

proxy_pass http://tomcat;

        proxy_redirect  off;

        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_set_header X-Forwarded-Proto  $scheme;

        client_max_body_size    10m;


        client_body_buffer_size 128k;

        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;

        index  ak47.html index.html index.htm;

root html;

}

location ~ .*.jsp$ {

        proxy_pass https://tomcat;

        proxy_set_header Host $host;

        }

        location ~ .*/.(gif|jpg|jpeg|png|bmp|swf|css|js)$ {                                    

        expires      30d;

        }


}

}