In this tutorial, we'll deploy Jekyll static site on Debian 13 with Nginx.
Jekyll is a static site generator. It takes text written in your favorite markup language and uses layouts to create a static website. You can tweak the site’s look and feel, URLs, the data displayed on the page, and more.
Deploying a static site with Jekyll and serving it through Nginx on Debian 13 is a reliable, high-performance way to host fast, secure content. In this guide, we’ll walk through each step from installing dependencies to configuring Nginx so that our site is production-ready. Let’s dive in!
Prerequisites
Before starting, make sure our new Debian 13 server is ready. The following components should be installed and configured:
- A Debian 13 installed dedicated server or KVM VPS.
- A normal user with root privileges.
- A domain name pointing A record to server IP.
Deploy Jekyll Static Site on Debian 13 with Nginx
Step 1. Update and Prepare the System
Before installing anything, we make sure our Debian 13 server is fully up to date:
sudo apt update
sudo apt upgrade -y
This ensures we have the latest security patches and package lists.
Step 2. Install Ruby, Nginx, and Build Tools
Jekyll is a Ruby-based static site generator. We install Ruby, Bundler (for managing gems), Nginx, and essential build tools:
sudo apt install -y ruby-full build-essential zlib1g-dev nginx
Step 3: Install Jekyll and Bundler
We install Jekyll and Bundler in the user environment.
echo 'export GEM_HOME="$HOME/.gem"' >> ~/.bashrc
echo 'export PATH="$HOME/.gem/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
gem install bundler jekyll
Check versions:
jekyll -v
bundle -v
Step 4: Create the Jekyll website
Create a new project:
mkdir -p ~/sites
cd ~/sites
jekyll new mysite
cd mysite
Install required gems:
bundle install
Build the production site:
JEKYLL_ENV=production bundle exec jekyll build
Step 5: Prepare the web root
Create the Nginx web directory and deploy the site files.
sudo mkdir -p /var/www/mysite
sudo rsync -av --delete _site/ /var/www/mysite/
sudo chown -R www-data:www-data /var/www/mysite
Step 6: Configure Nginx
Create a server configuration file:
sudo tee /etc/nginx/sites-available/mysite > /dev/null <<EOF
server {
listen 80;
server_name example.com www.example.com;
root /var/www/mysite;
index index.html;
location / {
try_files \$uri \$uri/ =404;
}
}
EOF
Note: Replace exmaple.com with your domain name.
Enable the site and test configuration:
sudo ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/
sudo nginx -t
Reload Nginx:
sudo systemctl reload nginx
Step 7: Configure Firewall
We need to allow HTTP and HTTPS ports in the firewall:
sudo ufw allow 80,443/tcp
sudo ufw reload
Step 8: Enable HTTPS with Let’s Encrypt
Install Certbot:
sudo apt install -y certbot python3-certbot-nginx
Generate the SSL certificate:
sudo certbot --nginx -d example.com
Test auto-renewal:
sudo certbot renew --dry-run
Step 9: Update workflow
Whenever we update the website, we run:
cd ~/sites/mysite
git pull
bundle install
JEKYLL_ENV=production bundle exec jekyll build
sudo rsync -av --delete _site/ /var/www/mysite/
sudo systemctl reload nginx
In this tutorial, we've deployed Jekyll static site on Debian 13 with Nginx. By following these steps, we’ve set up a modern Jekyll workflow on Debian 13 and configured Nginx to deliver our static site efficiently and securely.
Enjoy sharing your creations!
