diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 000000000..3cf461fb3 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,149 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; +daemon off; # runs in Docker container so doesn't need daemon mode + +events { + worker_connections 768; + # multi_accept on; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + gzip_disable "msie6"; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # Virtual Host Configs + ## + + upstream frontend { + server http://localhost:2700; + } + + upstream rest { + server http://localhost:2900; + } + + + server { + set $maintenance 0; + + listen 80; + + proxy_http_version 1.1; + + gzip on; + gzip_min_length 4096; + gzip_buffers 4 32k; + gzip_types application/x-javascript text/css; + gzip_vary on; + + server_name localhost 127.0.0.1; + charset utf-8; + client_max_body_size 64000m; + client_body_buffer_size 64m; + + # Turn off request body buffering to allow direct streaming uploads. + # Note that the request body will be buffered regardless of this directive + # value unless HTTP/1.1 is enabled for proxying (configured above). + proxy_request_buffering off; + + #keepalive_timeout 10; + #proxy_buffering off; + #proxy_connect_timeout 1200; + #proxy_send_timeout 1200; + #proxy_read_timeout 1200; + #send_timeout 1200; + + location /bundleservice { + if ($maintenance = 1) { + return 503; + } + proxy_pass http://rest/bundleservice; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $http_host; + proxy_connect_timeout 1200; + proxy_send_timeout 1200; + proxy_read_timeout 1200; + send_timeout 1200; + } + + location /rest { + if ($maintenance = 1) { + return 503; + } + proxy_pass http://rest; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $http_host; + proxy_connect_timeout 1200; + proxy_send_timeout 1200; + proxy_read_timeout 1200; + send_timeout 1200; + } + + + location / { + if ($maintenance = 1) { + return 503; + } + proxy_pass http://frontend/; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $http_host; + proxy_connect_timeout 1200; + proxy_send_timeout 1200; + proxy_read_timeout 1200; + send_timeout 1200; + } + + error_page 503 /error/503.html; + error_page 502 /error/50x.html; + location ^~ /error/ { + internal; + } + } +} +