Created
September 23, 2016 18:18
-
-
Save kricha/9ecd24f9b5c0e5cf39d62c6b3946b423 to your computer and use it in GitHub Desktop.
nginx https http/2.0 config
This file contains 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 domain.tld; | |
listen 80; | |
listen 443 ssl http2; | |
server_tokens off; | |
keepalive_timeout 70; | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
resolver 8.8.4.4 8.8.8.8 valid=300s; | |
resolver_timeout 10s; | |
ssl on; | |
#let's encrypt certificates | |
ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem; | |
ssl_trusted_certificate /etc/letsencrypt/live/domain.tld/chain.pem; | |
ssl_dhparam /etc/nginx/ssl/dhparam.pem; | |
ssl_session_timeout 1h; | |
ssl_session_cache shared:SSL:10m; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL; | |
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; | |
add_header X-Frame-Options DENY; | |
add_header X-Content-Type-Options nosniff; | |
root /var/www/html; | |
index index.php; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name domain.tld; | |
return 301 https://$host$request_uri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment