Created
October 12, 2018 14:41
-
-
Save MichalWi/1b10858374dd631ced8fc4d19ad07356 to your computer and use it in GitHub Desktop.
following this tutorial:
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
version: '3.1' | |
services: | |
production-nginx-container: | |
container_name: 'production-nginx-container' | |
image: nginx:latest | |
ports: | |
- "80:80” | |
- "443:443” | |
volumes: | |
- ./production.conf:/etc/nginx/conf.d/default.conf | |
- ./production-site:/var/www/html | |
- ./dh-param/dhparam-2048.pem:/etc/ssl/certs/dhparam-2048.pem | |
- /docker-volumes/etc/letsencrypt/live/[DOMAIN]/fullchain.pem:/etc/letsencrypt/live/[DOMAIN]/fullchain.pem | |
- /docker-volumes/etc/letsencrypt/live/[DOMAIN]/privkey.pem:/etc/letsencrypt/live/[DOMAIN]/privkey.pem | |
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 [DOMAIN] www.[DOMAIN]; | |
location / { | |
rewrite ^ https://$host$request_uri? permanent; | |
} | |
#for certbot challenges (renewal process) | |
location ~ /.well-known/acme-challenge { | |
allow all; | |
root /data/letsencrypt; | |
} | |
} | |
#https://[DOMAIN] | |
server { | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_name [DOMAIN]; | |
server_tokens off; | |
ssl_certificate /etc/letsencrypt/live/[DOMAIN]/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/[DOMAIN]/privkey.pem; | |
ssl_buffer_size 8k; | |
ssl_dhparam /etc/ssl/certs/dhparam-2048.pem; | |
ssl_protocols TLSv1.2 TLSv1.1 TLSv1; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5; | |
ssl_ecdh_curve secp384r1; | |
ssl_session_tickets off; | |
# OCSP stapling | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
resolver 8.8.8.8; | |
return 301 https://www.[DOMAIN]$request_uri; | |
} | |
#https://www.[DOMAIN] | |
server { | |
server_name www.[DOMAIN]; | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_tokens off; | |
ssl on; | |
ssl_buffer_size 8k; | |
ssl_dhparam /etc/ssl/certs/dhparam-2048.pem; | |
ssl_protocols TLSv1.2 TLSv1.1 TLSv1; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5; | |
ssl_ecdh_curve secp384r1; | |
ssl_session_tickets off; | |
# OCSP stapling | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
resolver 8.8.8.8 8.8.4.4; | |
ssl_certificate /etc/letsencrypt/live/[DOMAIN]/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/[DOMAIN]/privkey.pem; | |
root /var/www/html; | |
index index.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment