Authored by qinchao

nginx切换

... ... @@ -61,11 +61,10 @@ public class NginxSwitchCtrl {
map.put("gatewayServerHosts", gatewayHosts);
if ("test1".equals(env)||"test".equals(env)) {
//List<Map<String, Object>> awsList = localTest("aws");
List<Map<String, Object>> az2List = localTest("az2");
List<Map<String, Object>> qcloudList = localTest("qq");
//map.put("awsList", awsList);
map.put("qcloudList", qcloudList);
map.put("qcloudaz2List", Lists.newArrayList());
map.put("qcloudaz2List",az2List);
return new BaseResponse(map);
}
... ... @@ -256,8 +255,8 @@ public class NginxSwitchCtrl {
String path = this.getClass().getResource("").getPath().substring(6);
int index = path.indexOf("WEB-INF");
path = path.substring(0, index) + "bin/";
if ("aws".equals(cloud)) {
path = path + "aws.nginx.conf";
if ("az2".equals(cloud)) {
path = path + "az2.nginx.conf";
} else {
path = path + "qq.nginx.conf";
}
... ...
user www www;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
pid logs/nginx.pid;
# [ debug | info | notice | warn | error | crit ]
#error_log /Data/logs/nginx/nginx_error.log info;
error_log /Data/logs/nginx/nginx_error.log info;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
use epoll;
#maxclient = worker_processes * worker_connections / cpu_number
worker_connections 51200;
}
http
{
include mime.types;
default_type application/octet-stream;
#charset gb2312,utf-8;
charset utf-8;
log_format fenxi '$remote_addr|$http_x_forwarded_for|[$time_local]|$http_host|$request|'
'$status|$body_bytes_sent|$request_time|$upstream_response_time|$upstream_cache_status|$http_referer|'
'$http_user_agent|$upstream_addr';
#General Options
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_body_buffer_size 8m; #256k
#
#server_tokens off;
ignore_invalid_headers on;
recursive_error_pages on;
server_name_in_redirect off;
sendfile on;
#timeouts
keepalive_timeout 75s;
keepalive_requests 10000;
#test
#client_body_timeout 3m;
#client_header_timeout 3m;
#send_timeout 3m;
#TCP Options
tcp_nopush on;
tcp_nodelay on;
#fastcgi options
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;
#set_real_ip_from 10.159.191.0/24;
#real_ip_header X-Forwarded-For;
#hiden php version
fastcgi_hide_header X-Powered-By;
#size limits
client_max_body_size 50m;
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 application/json;
gzip_vary on;
add_header x-yh-nginx-dc qcloud;
fastcgi_temp_path /dev/shm/fastcgi_temp;
client_body_temp_path /dev/shm/client_body_temp;
# where the lua package exists
lua_package_path "/Data/local/openresty-1.9.15.1/nginx/conf/lua/?.lua;;";
init_by_lua_file "conf/lua/init_lua.lua";
lua_shared_dict luacachedb 500m;
#brower service
upstream brower {
server 10.66.104.7:8092;
server 10.66.104.39:8092;
keepalive 100;
}
#apigatewaystart
upstream apigateway {
server 10.66.104.2:8080 max_fails=5 fail_timeout=3s;
server 10.66.104.44:8080 max_fails=5 fail_timeout=3s;
server 10.66.104.28:8080 max_fails=5 fail_timeout=3s;
server 10.66.104.29:8080 max_fails=5 fail_timeout=3s;
keepalive 32;
}
#apigatewayend
#grayapigatewaystart
upstream grayapigateway {
server 10.66.104.2:8080 max_fails=5 fail_timeout=3s;
keepalive 32;
}
#grayapigatewayend
# activity
upstream activityApi{
server 10.66.104.17:8090;
server 10.66.104.26:8090;
keepalive 100;
}
# wechat
upstream apiWechat {
server 10.66.104.7:8094;
server 10.66.104.39:8094;
keepalive 100;
}
# erp gateway
upstream erpgateway {
server 10.66.104.7:8089;
server 10.66.104.39:8089;
keepalive 100;
}
#upstream
fastcgi_next_upstream error timeout invalid_header http_500;
#limit_zone limit $binary_remote_addr 1m;
#fastcgi cache
#fastcgi_cache_path /nginxcache levels=1:2 keys_zone=two:10m inactive=1d max_size=3000m;
#for example just for study! have fun!
include vhosts/api.yoho.cn.conf;
include vhosts/api_single.yoho.cn.conf;
include vhosts/erp.yoho.yohoops.org.conf;
include vhosts/single.conf;
}
\ No newline at end of file
... ...