Deploying this Blog: Hugo + Traefik + Letsencrypt + Ubuntu
How This Blog Was Deployed with Hugo & Traefik
Here’s how I deployed this very blog in production using Hugo for static site generation, Traefik as a reverse proxy, and GoDaddy for DNS management.
Prerequisites
- A server (VPS or cloud instance) with a public IP address
- Domain name managed via GoDaddy
1. Installing Hugo on the Server
I installed Hugo on my server to build the static site for production:
sudo apt install hugo # Ubuntu/Debian
# or for other systems, use the official Hugo release binaries
### 2. Building the Hugo Site for Production
type: "posts"
To generate the static site, I ran:
```sh
hugo --minify
This created the production-ready files in the public/ directory.
3. Setting Up Traefik and Let’s Encrypt
I installed Traefik (using the official binary) and configured it to serve the public/ directory. For HTTPS, I enabled Let’s Encrypt so certificates are managed automatically. Here’s a sample of the Traefik static config I used:
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
certificatesResolvers:
letsencrypt:
acme:
email: <your-email>
storage: acme.json
httpChallenge:
entryPoint: web
4. GoDaddy DNS Settings
On GoDaddy, I updated my domain’s DNS settings:
- Added or edited A records for
@andwwwto point to my server’s public IP address. - Added any needed subdomain A records.
- Waited for DNS propagation.
5. Serving the Blog in Production
To go live, I started Traefik and made sure it was serving the public/ directory. Then I visited my domain to confirm everything was working and HTTPS was active.
Tip: I use scripts to rebuild and redeploy this blog after content changes, making updates quick and reliable.
Useful Commands & Troubleshooting (Production)
Starting and Stopping Services
Start Traefik (systemd example)
sudo systemctl start traefik
Stop Traefik
sudo systemctl stop traefik
Deploy Hugo static site (build and serve)
hugo --minify
sudo cp -r public/* /var/www/html/
Troubleshooting Commands
- View Traefik logs:
sudo journalctl -u traefik - Check Hugo build output:
hugo --minify - Test if ports are open (replace 80/443 with your port):
sudo lsof -i :80 sudo lsof -i :443 - Check DNS resolution:
nslookup yourdomain.com dig yourdomain.com
😄 Hey, now that you know how this blog works behind the scenes, don’t get any funny ideas!