Is it possible to use Hugo in a shared hosting?

I have an shared hosting, but I want to know whether is possible run Hugo on this hosting?

If you generate your HTML locally then it’s only a matter of using FTP or whatever else you prefer to send these files to your shared hosting space.

Hugo is a Static Site Generator. It does not have a database neither does it serve HTML. It only generates the HTML pages along with their assets.

hmmm in theory, now that hugo supports different content sources, you can have a custom config.toml and different users.

The over engineering involved is expensive in time, but it could be done.

Does it? Not sure about that. There has been talk about Hugo supporting multiple content directories but I don’t think it’s implemented yet.

EDIT
The Github issue to add support for multiple contentDirs is still open @brunoamaral See: https://github.com/gohugoio/hugo/issues/3757

1 Like

With Hugo 0.32 you can create symbolic links inside /content – but that was maybe not what was described here …

To use Hugo itself, which is the program/binary, possibly. It depends on your host. You don’t need root/sudo access to use it so you might be able to upload the binary and use it on a shared server.

With the way Hugo works however, as others have mentioned, you can use Hugo locally on your computer, on a CI provider, or somewhere else and generate your website’s files, and then FTP, SFTP, SCP, etc your files to your shared hosting provider without any problems.

Also, Netlify provides static website hosting for free.

Yes. That is how I host some Hugo sites.

I am not sure if this will help you, but I build the site, and then rsync it over to my shared host.

As the others have mentioned, it is possible to use the HTML generated by Hugo anywhere, but most shared host won’t be able to run Hugo as a program, on the shared hosting server. :slight_smile:

1 Like

It depends upon the shared hosting and what you want to do. Do you mean you want to run hugo to generate the site, or run hugo server on the shared hosting? The former makes the most sense to me, and would make sense if you want to have a self-contained environment that you can ssh to, to do all the work. The latter is more of a challenge but not impossible, if you also wanted to run the “dev” version of your site, hosting it in the hugo server web server. You’d need to have the capability on the service to forward a port in, to whatever port you run hugo server on.

I use Webfaction for a lot of my hosting, and have compiled various programs on it, which is possible due to its flexibility and what they allow. I have not tried compiling or running Hugo there, but imagine it is possible.

FTR I do the same thing @maiki does with rsync. Keep note though it will be slightly slower especially on larger sites. For instance, if you’re pushing a new templated page to the site with rsync, rsync will have to update that page, along with every page that links to it, and any templating changes will obviously need to update every page on the site.

If you’re using git and building at the destination, you push a change to the template as a change to one file, which is the only file pushed, and hugo runs pretty fastlike last time I checked :smile: for the rest.