Last active
May 20, 2019 15:28
-
-
Save dbodyas/160cb576e5fe6f47f8855d9d3cff2bb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
error_log stderr; | |
pid nginx.pid; | |
daemon off; | |
events { | |
worker_connections 768; | |
} | |
http { | |
types_hash_max_size 2048; | |
include mime.types; | |
server { | |
listen {{ $.PORT }}; | |
server_name _; | |
{{ if ne $.NGINX_ROOT "" }} | |
root /app/www/{{ $.NGINX_ROOT }}; | |
{{ else }} | |
root /app/www; | |
{{ end }} | |
index index.html; | |
port_in_redirect off; | |
#brotli on; | |
#brotli_comp_level 3; | |
#brotli_types text/plain text/xml application/json text/x-component application/json application/xml application/rss+xml; | |
#brotli_static on; | |
gzip on; | |
gzip_min_length 1100; | |
gzip_buffers 4 32k; | |
gzip_types text/plain text/xml application/json text/x-component application/json application/xml application/rss+xml; | |
gzip_vary on; | |
gzip_comp_level 6; | |
gzip_static on; | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
location /bundle.js { | |
add_header Cache-Control max-age=31536000; | |
} | |
location /index.html { | |
add_header Cache-Control no-cache; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen [::]:80; | |
listen 80; | |
server_name {{ .NOSSL_SERVER_NAME }}; | |
access_log /var/log/nginx/{{ .APP }}-access.log; | |
error_log /var/log/nginx/{{ .APP }}-error.log; | |
return 301 https://$host:443$request_uri; | |
} | |
server { | |
listen [::]:443 ssl http2; | |
listen 443 ssl http2; | |
server_name {{ .NOSSL_SERVER_NAME }}; | |
access_log /var/log/nginx/{{ .APP }}-access.log; | |
error_log /var/log/nginx/{{ .APP }}-error.log; | |
ssl_certificate {{ .APP_SSL_PATH }}/server.crt; | |
ssl_certificate_key {{ .APP_SSL_PATH }}/server.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
keepalive_timeout 70; | |
location / { | |
proxy_pass http://{{ .APP }}; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
proxy_set_header X-Forwarded-Port $server_port; | |
proxy_set_header X-Request-Start $msec; | |
} | |
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf; | |
} | |
upstream {{ .APP }} { | |
{{ range .DOKKU_APP_LISTENERS | split " " }} | |
server {{ . }}; | |
{{ end }} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment