.....
user nobody;
worker_processes 8;
error_log /opt/logs/nginx/nginx_error.log crit;
pid /usr/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;events
{ use epoll; worker_connections 51200;}http
{ include mime.types; default_type application/octet-stream;# charset gb2312;
server_names_hash_bucket_size 128;sendfile on;tcp_nopush on;keepalive_timeout 120;tcp_nodelay on;output_buffers 4 32k; postpone_output 1460; client_header_buffer_size 128k; large_client_header_buffers 4 256k;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;client_max_body_size 50m;client_body_buffer_size 256k;proxy_connect_timeout 30;proxy_send_timeout 30;proxy_read_timeout 60;#load css js#proxy_buffer_size 4k;#proxy_buffers 4 32k;#proxy_busy_buffers_size 64k;proxy_buffer_size 128k;proxy_buffers 32 128k;proxy_busy_buffers_size 128k;proxy_temp_file_write_size 128k; proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;proxy_max_temp_file_size 128m;proxy_store on;proxy_store_access user:rw group:rw all:r; 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;#limit_zone crawler $binary_remote_addr 10m;
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; ###配置负载方式###upstream test123 { server 10.10.1.201:7878;}upstream crmtest123 {
server 10.10.1.201:8090;}###配置站点###
server { listen 80 default; server_name www.test123.cn ;set $tag "0";
if ( $host !~ ^www.test123.cn$ ){ set $tag "$tag,1"; } if ( $host !~ ^test123.cn$ ){ set $tag "$tag,2"; } if ( $tag ~ ^0,1,2$ ){ return 403; }location / {
proxy_pass http://test123; index index.html; 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 http; proxy_send_timeout 6000;# rewrite ^/webPage/?$ / permannet;
# rewrite ^/webPage/(*)$/(.*)$ /$1/$2 ;# rewrite ^/webPage/([0-9a-z]+)/(.*)$ /$1/$2 ;
}
location ~* /*Register.html {
rewrite ^(.*) https://$host$1 permanent; } location ~* /*RegisterNext.html { rewrite ^(.*) https://$host$1 permanent; } location ~* /*RegisterLast.html { rewrite ^(.*) https://$host$1 permanent; } location ~* /*login.html { rewrite ^(.*) https://$host$1 permanent; } location ~* /*acc_zhcz.html { rewrite ^(.*) https://$host$1 permanent; } location ~* /*acc_zhtx.html { rewrite ^(.*) https://$host$1 permanent; } location ~* /*wytz_tb.html { rewrite ^(.*) https://$host$1 permanent; }location ~* /*/ssl/frame_top_new.jsp {
rewrite ^(.*) https://$host$1 permanent; } location ~* /*/ssl/frame_bottom_new.jsp { rewrite ^(.*) https://$host$1 permanent; } location ~* /*/ssl/xx.jsp { rewrite ^(.*) https://$host$1 permanent; } location ~* /*/manage/code.jsp { rewrite ^(.*) https://$host$1 permanent; } location ~* /*/webPage/registerOffLine/*.* { rewrite ^(.*) https://$host$1 permanent; }# location ~* \.(js|css|do|gif|jpg|jpeg|png|bmp|ico|rar|zip|wma|flv|swf)$ { # expires 1h;# rewrite ^(.*) https://$host$1 permanent;# }
access_log /opt/logs/nginx/www.test123-access.log access;
}server { listen 443; server_name www.test123.cn ;ssl on;
ssl_certificate /usr/local/nginx/ssl/www.test123.crt; ssl_certificate_key /usr/local/nginx/ssl/www.test123.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_session_cache shared:SSL:10m; location / { rewrite ^(.*) http://www.test123.cn$1 permanent; }location ~* /*Register.html {
proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; } location ~* /*RegisterNext.html { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; } location ~* /*RegisterLast.html { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; } location ~* /*login.html { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; } location ~* /*acc_zhcz.html { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; } location ~* /*acc_zhtx.html { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240;}
location ~* /*wytz_tb.html { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; } location ~* /*frame_top_new.jsp { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240;}
location ~* /*frame_bottom_new.jsp {
proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240;}
location ~* /*xx.jsp { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240;}
location ~* /*/manage/code.jsp { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240;}
location ~* /*/webPage/registerOffLine/*.* {
proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240;}
location ~* \.(js|css|do|gif|jpg|jpeg|png|bmp|ico|rar|zip|wma|flv|swf)$ { proxy_pass http://test123; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240;
}
access_log /opt/logs/nginx/https.www.test123-access.log access;
}
server { listen 80; server_name test123.cn; location / { rewrite ^(.*) http://www.test123.cn$1 permanent; }
}
server { listen 80; server_name crm.test123.cn; location / { proxy_pass http://crmtest123; index index.html; 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 http; proxy_send_timeout 6000; } access_log /opt/logs/nginx/crm.test123-access.log access;} server { listen 84; server_name localhost; location / { stub_status on; access_log off; } } }