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_logLogs/access.log main;
#sendfileon;
#tcp_nopushon;
#keepalive_timeout0;
Keepalive_timeout65;
Gzipon;
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 $ permanent;
CharSet Utf-8;
Access_log Logs/host.access.log Main;
Root Html/root;
Location/{
Proxy_pass Http://tomcat;
Proxy_redirectoff;
Proxy_set_headerHost $host;
Proxy_set_headerx-real-ip $remote _addr;
Proxy_set_headerx-forwarded-for $proxy _add_x_forwarded_for;
Proxy_set_header X-forwarded-proto $scheme;
Client_max_body_size10m;
Client_body_buffer_size128k;
Proxy_connect_timeout90;
Proxy_send_timeout90;
Proxy_read_timeout90;
Proxy_buffer_size4k;
Proxy_buffers4 32k;
Proxy_busy_buffers_size64k;
Proxy_temp_file_write_size64k;
index ak47.html index.html index.htm;
}
# animals Do you bauhinia cha Kinh crypto qi 彂
Location ~. *.jsp$ {
Proxy_pass Https://tomcat;
Proxy_set_header Host $host;
}
Location ~. * *. (GIF|JPG|JPEG|PNG|BMP|SWF|CSS|JS) $ {
Expires 30d;
}
}
server {
Listen443;
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;
}
}
}
This article is from "Poker Face" blog, please make sure to keep this source http://lirenpgood.blog.51cto.com/9747573/1775282
Nginx+tomcat do static and dynamic separation configuration +nginx+ssl