Skip to content

Instantly share code, notes, and snippets.

@CMGS
Last active November 2, 2015 08:25
Show Gist options
  • Save CMGS/e969e614928c2ee8bbf0 to your computer and use it in GitHub Desktop.
Save CMGS/e969e614928c2ee8bbf0 to your computer and use it in GitHub Desktop.
conf
worker_processes {{worker_processes}};
error_log stderr info;
events {
worker_connections {{worker_connections}};
}
daemon off;
http {
default_type application/octet-stream;
log_format nbe '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
client_max_body_size 500m;
client_body_buffer_size 256k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
underscores_in_headers on;
ignore_invalid_headers off;
gzip on;
map $http_upgrade $connection_upgrade {
default upgrade;
'' '';
}
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_http_version 1.1;
proxy_buffer_size 256k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
upstream {{appname}}_{{entrypoint}} {
zone {{appname}}_{{entrypoint}} {{shm_size}};
{%for server in servers%}
server {{server.addr}} max_fails={{server.max_fails}} fail_timeout={{server.fail_timeout}};
{%endfor%}
keepalive 32;
fair;
}
server {
listen 80;
server_name {{server_name}};
underscores_in_headers on;
ignore_invalid_headers off;
rewrite ^/(.*)/favicon.ico$ /favicon.ico last;
location ~* (favicon.ico) {
log_not_found off;
break;
}
location ~ ^/ {
proxy_set_header X-NBE-APPNAME {{appname}};
proxy_set_header X-NBE-ENTRYPOINT {{entrypoint}};
proxy_set_header Connection $connection_upgrade;
proxy_set_header HOST $host;
proxy_read_timeout 600;
access_log /{{nginx_log_root_dir}}/{{appname}}/{{entrypoint}}/access.log nbe;
error_log /{{nginx_log_root_dir}}/{{appname}}/{{entrypoint}}/error.log error;
proxy_pass http://{{appname}}_{{entrypoint}};
}
location = /__api__/dyups {
dynamic_upstream;
}
}
}
@zheplusplus
Copy link

    location ~ ^/ {
            proxy_set_header X-NBE-APPNAME odan;
            proxy_set_header X-NBE-ENTRYPOINT web-macvlan;
            proxy_set_header Connection $connection_upgrade;
            proxy_set_header HOST $host;
            proxy_read_timeout 600;
            access_log /tmp/$appname-access.log;
            error_log /tmp/$appname-error.log error;
            proxy_pass http://$appname;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment