Last active
January 8, 2020 01:29
-
-
Save mavelar/c499b45142f36f860d7e16997157529b to your computer and use it in GitHub Desktop.
Nginx Configuration for Docker Deployments
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 { | |
| server_name {DOMAINS}; | |
| # include snippets/security.conf; | |
| rewrite ^/(.*)/$ /$1 permanent; | |
| # if ($redirect_uri ) { | |
| # return 301 $redirect_uri; | |
| # } | |
| location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg)$ { | |
| root {DOCUMENT ROOT}; | |
| log_not_found off; | |
| access_log off; | |
| expires 7d; | |
| add_header Pragma public; | |
| add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
| } | |
| location / { | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| proxy_pass http://127.0.0.1:8080; | |
| } | |
| access_log /var/log/nginx/access.log; | |
| error_log /var/log/nginx/error.log warn; | |
| listen 443 http2 ssl; # managed by Certbot | |
| ssl_certificate /etc/letsencrypt/live/{DOMAIN}/fullchain.pem; # managed by Certbot | |
| ssl_certificate_key /etc/letsencrypt/live/{DOMAIN}/privkey.pem; # managed by Certbot | |
| include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
| ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
| } | |
| server { | |
| return 301 https://$host$request_uri; | |
| listen 80; | |
| server_name {DOMAINS}; | |
| } |
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 { | |
| server_name {DOMAINS}; | |
| # include snippets/security.conf; | |
| rewrite ^/(.*)/$ /$1 permanent; | |
| # if ($redirect_uri ) { | |
| # return 301 $redirect_uri; | |
| # } | |
| location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg)$ { | |
| root {DOCUMENT ROOT}; | |
| log_not_found off; | |
| access_log off; | |
| expires 7d; | |
| add_header Pragma public; | |
| add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
| } | |
| location / { | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| proxy_pass http://127.0.0.1:8080; | |
| } | |
| access_log /var/log/nginx/access.log; | |
| error_log /var/log/nginx/error.log warn; | |
| listen 80; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment