Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
127 lines (102 sloc) 2.86 KB
env SERVER_NAME;
user root;
worker_processes 4;
daemon off;
#worker_rlimit_nofile
error_log /dev/stdout info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
#multi_accept on;
#use
}
http {
perl_modules perl/lib;
perl_set $server_name_from_env 'sub { return $ENV{"SERVER_NAME"}; }';
include /etc/nginx/mime.types;
default_type application/octet-stream;
#access_log off;
access_log /dev/stdout;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_vary off;
#gzip_buffers
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml text/javascript application/javascript application/json text/mathml;
gzip_min_length 1000;
gzip_disable MSIE [1-6]\.;
server_names_hash_bucket_size 64;
types_hash_max_size 2048;
types_hash_bucket_size 64;
#proxy_read_timeout
#client_body_buffer_size
#client_max_body_size
limit_req_zone $binary_remote_addr zone=default:10m rate=1r/s;
proxy_cache_path /var/www/nginx/cache levels=1:2 keys_zone=cache-space:4m max_size=50m inactive=120m;
proxy_temp_path /var/www/nginx/tmp;
#
# upstreams
#
upstream blue-app {
server localhost:8091;
keepalive 256;
}
upstream green-app {
server localhost:8092;
keepalive 256;
}
#
# proxy to web type container
#
server {
listen 80;
error_page 500 502 503 504 @error;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
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-Host $host;
proxy_set_header X-Forwarded-Server $host;
if (-e /etc/nginx/switch/maintenance) {
error_page 503 @maintenance;
return 503;
}
if (-e /etc/nginx/switch/blue) {
proxy_pass http://blue-app;
}
if (-e /etc/nginx/switch/green) {
proxy_pass http://green-app;
}
}
location @error {
add_header Cache-Control no-cache;
root /var/www/nginx/html;
rewrite ^(.*)$ /error.html break;
}
location @maintenance {
add_header Cache-Control no-cache;
root /var/www/nginx/html;
rewrite ^(.*)$ /maintenance.html break;
}
}
#
# for health check and monitoring
#
server {
listen 8090;
server_name $server_name_from_env;
location /status {
stub_status on;
access_log off;
}
}
include /etc/nginx/conf.d/*.conf;
}
You can’t perform that action at this time.