|
# Redireciona para HTTPS |
|
server { |
|
listen 80; |
|
listen [::]:80; |
|
server_name ___SEU_DOMINIO_AQUI___; |
|
return 301 https://$host$request_uri; |
|
} |
|
|
|
# HTTPS |
|
server { |
|
listen 443 ssl http2; |
|
listen [::]:443 ssl http2; |
|
|
|
server_name ___SEU_DOMINIO_AQUI___; |
|
|
|
root /home/luizotavio/front/; |
|
index index.html index.htm index.nginx-debian.html index.php; |
|
|
|
ssl_certificate /etc/letsencrypt/live/___SEU_DOMINIO_AQUI___/fullchain.pem; # managed by Certbot |
|
ssl_certificate_key /etc/letsencrypt/live/___SEU_DOMINIO_AQUI___/privkey.pem; # managed by Certbot |
|
ssl_trusted_certificate /etc/letsencrypt/live/___SEU_DOMINIO_AQUI___/chain.pem; |
|
|
|
# Improve HTTPS performance with session resumption |
|
ssl_session_cache shared:SSL:10m; |
|
ssl_session_timeout 5m; |
|
|
|
# Enable server-side protection against BEAST attacks |
|
ssl_prefer_server_ciphers on; |
|
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5; |
|
|
|
# Disable SSLv3 |
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; |
|
|
|
# Diffie-Hellman parameter for DHE ciphersuites |
|
# $ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096 |
|
ssl_dhparam /etc/ssl/certs/dhparam.pem; |
|
|
|
# Enable HSTS (https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security) |
|
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains"; |
|
|
|
# Enable OCSP stapling (http://blog.mozilla.org/security/2013/07/29/ocsp-stapling-in-firefox) |
|
ssl_stapling on; |
|
ssl_stapling_verify on; |
|
resolver 8.8.8.8 8.8.4.4 valid=300s; |
|
resolver_timeout 5s; |
|
|
|
# We're gonna try to send all to index.html |
|
location / { |
|
try_files $uri /index.html; |
|
} |
|
|
|
# deny access to .htaccess files, if Apache's document root |
|
# concurs with nginx's one |
|
# |
|
location ~ /\.ht { |
|
deny all; |
|
} |
|
|
|
location ~ /\. { |
|
access_log off; |
|
log_not_found off; |
|
deny all; |
|
} |
|
|
|
gzip on; |
|
gzip_disable "msie6"; |
|
|
|
gzip_comp_level 6; |
|
gzip_min_length 1100; |
|
gzip_buffers 4 32k; |
|
gzip_proxied any; |
|
gzip_types |
|
text/plain |
|
text/css |
|
text/js |
|
text/xml |
|
text/javascript |
|
application/javascript |
|
application/x-javascript |
|
application/json |
|
application/xml |
|
application/rss+xml |
|
image/svg+xml; |
|
|
|
access_log off; |
|
#access_log /var/log/nginx/___SEU_DOMINIO_AQUI___-access.log; |
|
error_log /var/log/nginx/___SEU_DOMINIO_AQUI___-error.log; |
|
} |