Skip to content

Commit

Permalink
Add preconfigured nginx.conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
bkgoksel committed Mar 19, 2019
1 parent e965191 commit 3d54284
Showing 1 changed file with 149 additions and 0 deletions.
149 changes: 149 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
}

0 comments on commit 3d54284

Please sign in to comment.