Host multiple Hugo instances on one VM?

Hey there,

I just started digging into Hugo this morning and very excited to give it a (Hu)go. I currently host multiple Ghost blogs on a Digital Ocean droplet. Is it possible to server multiple Hugo instances on a single host? I can only bind one at a time to port 80 obviously, but is there some other config file or setting that will handle virtual hosts so I can accomplish this goal?

Thanks,
Brian

Yes, you can host as many sites generated with Hugo as you want on one VM. The first thing to note is that you don’t really serve the site with Hugo, you just output static html.

You can generate multiple sets of these living in different folders. Then you can setup your webserver (e.g. Nginx or Apache) to point different sub domains or different paths in URLs to these different static sites.

@hnarayanan ok thanks - this is exactly what I was confused about. I was thinking Apache or similar service would have to play a part in managing multiple domains on a single host. I’ll give it a shot and report back with anything interesting I learn.

Brian

Great.

It really is not complicated, especially if you’ve already figured it out for multiple Ghost blogs. First figure out how Apache/nginx/whatever can be setup to serve multiple sites (e.g. https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts) from a single VM, then create individual sites using Hugo (simply a bunch of static files) to be served. :smile:

Right, I’ve got the apache config down, but it’s the whole “two sites on port 80” that are confusing me because when I start Hugo server #1 on port 80 that’s fine, but then #2 will complain about port 80 already being in use. Trying to figure out how to get them both to “listen” while both working on port 80.

Again, there is no need to run Hugo and have it listen. You use Hugo to build a static site and then it’s out of the picture. What you have is just a folder filled with html files, some css and other assets. You just serve this static content via Apache.

This is not the same as having multiple Ghost instances running behind Apache simultaneously.

Thanks I think I was overthinking it since my Apache config was not properly serving either site. I’ll keep at it and report back.

Ah I see what I think I’ve been missing…I didn’t realize I’d have to generate a static site for an Apache-friendly version to load. Working on that now.

OK, with static site generated and vhosts created, I’m good to go. Thanks @hnarayanan!

1 Like

Good to hear. Enjoy!

1 Like