3 min read

Running Hugo generated blog on a VPS

The question is; can you run a Hugo generated folder on a remote Ubuntu webserver if Hugo is not installed?

The answer is Affirmative. In fact, that is one of the biggest selling points of Hugo. Because Hugo is a Static Site Generator (SSG), it only needs to run when you are building the site, not when your server is serving it.
Your VPS doesn’t need to know what Hugo is or have Go installed; it just needs a standard web server (like Apache or Nginx) to hand pre-built HTML, CSS, and images to your visitors.

Here’s the workflow. Instead of running Hugo on the VPS, split the work into a build-and-transfer pipeline:

  1. The Build (Local Machine or CI/CD): You write your markdown files and run the hugo command or ‘blogdown::build_site()’ if the platform is RStudio. Hugo compiles everything in a split second into a single folder called public/.
  2. The Transfer: Move only the contents of that public/ folder over to your VPS.
  3. The Serve: Your VPS handles the requests natively and securely, serving raw files without any server-side processing overhead.

Deploy Without Installing Hugo on the VPS

Since you aren’t building on the server, you just need a way to get your local files onto the remote server. Here are the most efficient ways to do it:

1. The Simple Way: SFTP (FileZilla / Cyberduck)

  • Run hugo in your local terminal to generate the site.
  • Open your preferred SFTP client and connect to your VPS using your user credentials.
  • Upload everything inside your local public/ folder directly into your domain’s web directory (usually /home/your_username/yourdomain.com/).

2. The Faster Way: Rsync (Command Line)

If you prefer using the terminal, rsync is highly recommended. It compares your files and only uploads the changes, saving massive amounts of time on updates.

From your local project folder, you can build and deploy with a quick two-line command:

hugo
rsync -avz --delete public/ username@your-vps-ip:/home/username/yourdomain.com/

3. The Automated Way: GitHub Actions

If you keep your website’s source code in a GitHub repository, you don’t even need to build it on your own computer.

  • You push your markdown edits to GitHub.
  • A free GitHub Actions workflow triggers, spins up a temporary container, installs Hugo there, builds your site, and automatically pushes the final public/ folder to your DreamHost VPS via SFTP.

Tip πŸ’‘

When Hugo builds your site, it dumps everything into a folder named public. You must upload the contents of that folder into your DreamHost domain directory, not the folder itself.

Your directory structure on the VPS should look like this:

yourdomain.com/
β”œβ”€β”€ index.html
β”œβ”€β”€ 404.html
β”œβ”€β”€ css/
└── js/

If your index.html is buried inside a yourdomain.com/public/ folder on the server, visitors will get a “404 Not Found” or a blank directory listing unless they explicitly type yourdomain.com/public into their browser.