Skip to content

Instantly share code, notes, and snippets.

@aryulianto
Last active August 15, 2017 11:22
Show Gist options
  • Save aryulianto/6f34abde2519267e24a2f136424cbbbd to your computer and use it in GitHub Desktop.
Save aryulianto/6f34abde2519267e24a2f136424cbbbd to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name glibogor.or.id;
# redirect all urls to https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
# domain
server_name glibogor.or.id;
# ssl certificate config
ssl_certificate /etc/nginx/ssl/certs/glib-fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/certs/glib-privkey.pem;
ssl_trusted_certificate /etc/nginx/ssl/certs/glib-chain.pem;
# Diffie-Hellman parameter for DHE ciphersuites
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
# SSL Settings
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';
ssl_prefer_server_ciphers on;
# add Strict-Transport-Security to prevent man in the middle attacks
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
# add_header Strict-Transport-Security "max-age=31536000";
add_header Strict-Transport-Security max-age=63072000;
# OCSP Stapling
ssl_stapling on;
ssl_stapling_verify on;
error_log /var/log/nginx/glib-error.log;
access_log /var/log/nginx/glib-access.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://172.31.0.4;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment