Last active
January 20, 2016 02:44
-
-
Save anon5r/a4041c244201cd468f62 to your computer and use it in GitHub Desktop.
Let's EncryptでSSL対応+HTTP2対応したときの設定
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 { | |
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also https://gist.github.com/anon5r/d3e2de229049a281ebaf