Skip to content

Instantly share code, notes, and snippets.

@joshcummingsdesign
Last active November 26, 2023 10:44
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joshcummingsdesign/2fb1a3e99ad730b4450194ae0ba7f77e to your computer and use it in GitHub Desktop.
Save joshcummingsdesign/2fb1a3e99ad730b4450194ae0ba7f77e 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