Skip to content

Instantly share code, notes, and snippets.

@Negaihoshi
Last active March 17, 2016 12:47
Show Gist options
  • Save Negaihoshi/f044b4baf53f261aee34 to your computer and use it in GitHub Desktop.
Save Negaihoshi/f044b4baf53f261aee34 to your computer and use it in GitHub Desktop.
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name www.negai.moe negai.moe;
return 301 https://negai.moe$request_uri;
}
server {
server_name www.negai.moe negai.moe; # Replace with your domain
access_log /var/log/nginx/www_ss.log;
listen [::]:443 ssl http2 default_server ipv6only=on;
listen 443 ssl http2;
server_name negai.moe;
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';
ssl_certificate /etc/letsencrypt/live/www.negai.moe/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.negai.moe/privkey.pem;
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_session_timeout 10m;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
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_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/www.negai.moe/chain.pem;
keepalive_timeout 70;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
location / {
proxy_pass http://localhost:2368;
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_buffering off;
}
if ($host = www.negai.moe) {
rewrite ^(.*) https://negai.moe:443$request_uri? permanent;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment