Skip to content

Instantly share code, notes, and snippets.

@edib
Forked from joshcummingsdesign/conf
Last active December 30, 2022 12:04
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 edib/46045e8d0a7a400fcae61fb9284d7239 to your computer and use it in GitHub Desktop.
Save edib/46045e8d0a7a400fcae61fb9284d7239 to your computer and use it in GitHub Desktop.
NGINX config for a Jekyll site using SSL
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name example.com www.example.com;
#ssl_certificate
#ssl_certificate_key
root /var/www/example.com;
index index.html index.htm;
if (!-f "${request_filename}index.html") {
rewrite ^/(.*)/$ /$1 permanent;
}
if ($request_uri ~* "/index.html") {
rewrite (?i)^(.*)index\.html$ $1 permanent;
}
if ($request_uri ~* ".html") {
rewrite (?i)^(.*)/(.*)\.html $1/$2 permanent;
}
error_page 404 /404.html;
location / {
try_files $uri $uri.html $uri/ =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment