Deploying a Jekyll build to Mojave
Friday May 09 2025 • 07:44 AM
I’m using the nginx server because Dokku installed it and I didn’t want to have to learn yet another tool like Apache.
Directory for storing sites
The first thing I did was create a directory for each the new static site.
sudo mkdir -p /var/www/test-blog.example.org/html
User Permissions
Next I gave my user permission to modify the directory with sudo chown -R $USER:$USER /var/www/test-blog.example.org
(I have myself permissions one directory above)
Build Process
I built the site locally with my custom build rake task (which is nothing more than JEKYLL_ENV=production bundle exec jekyll build
).
Sync Process
Next I uploaded the files via rsync with rsync -avz --delete _site/ user@host:/var/www/test-blog.example.org/html
I had Gemini 2.5 Flash summarize the command above in T3.chat:
this command is designed to efficiently and accurately synchronize the contents of the local _site/ directory to the remote /var/www/sites/example.org directory, preserving file attributes, compressing data during transfer, and deleting any files on the remote side that are no longer in the local source.
Nginx Server Blocks
DigitalOcean has a nice explanation article about setting up Nginx server blocks.
When using the Nginx web server, server blocks (similar to virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain on a single server.
sites-available directory
Since I want this Jekyll test blog to be available at test-blog.example.org
, I copied the default configuration file sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/test-blog.example.com
and updated the contents.
/etc/nginx/sites-available/test-blog.example.org
file and added an nginx config:
server { listen 80; server_name test-blog.example.org; root /var/www/sites/example.com; index index.html; location / { try_files $uri $uri/ =404; } }
Enabling nginx blocks
After saving the changes above I enabled the site by creating a symlink between my config file and the sites-enabled directory.
$ sudo ln -s /etc/nginx/sites-available/test-blog.bucareli.co /etc/nginx/sites-enabled
Test and Restart Nginx
Next I run a test and restart nginx with
$ sudo nginx -t && sudo systemctl reload nginx
Porkbun domain
As long as the A Records are pointed to the IP Address of the server, it should work.
HTTPS
Since Dokku is no longer handling SSL, it’s gotta be done manually.
First I installed certbot and some other dependencies.
sudo apt update sudo apt install certbot python3-certbot-nginx
Next I run sudo certbot --nginx -d test-blog.example.org
and I’m prompted for my e-mail.
I said yes to the EFF.org newsletter because I liked how simple this whole process was. Done!