Skip to content

Instantly share code, notes, and snippets.

@anon5r
Last active January 20, 2016 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anon5r/a4041c244201cd468f62 to your computer and use it in GitHub Desktop.
Save anon5r/a4041c244201cd468f62 to your computer and use it in GitHub Desktop.
Let's EncryptでSSL対応+HTTP2対応したときの設定
server {
listen 443 ssl http2;
server_name example.com;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log main;
root /var/www/example.com/public;
index index.html;
ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# See also about following includes https://gist.github.com/anon5r/d3e2de229049a281ebaf
include ssl_common.conf;
add_header Content-Security-Policy upgrade-insecure-requests;
# gzip settings
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain text/xml text/css text/javascript application/x-javascript image/png image/jpeg image/gif;
gzip_disable "msie6";
gzip_vary on;
output_buffers 1 32k;
if_modified_since before;
client_header_buffer_size 2k;
large_client_header_buffers 4 8k;
location / {
allow all;
try_files $uri $uri/ /index.php?$args;
}
location /favion.ico {
log_not_found off;
}
}
server {
listen 80;
server_name www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 80;
server_name example.com;
return 301 https://example.com$request_uri;
}
@anon5r
Copy link
Author

anon5r commented Jan 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment