Has anyone tried deploying HUGO generated pages to a hosted site like IONOS or GoDaddy? I am a newbie to HUGO and just curious. Would like to see if I can replace my Wordpress site with a. Static site developed using HUGO.
Thanks
You run hugo
, then you copy everything inside of public
to the root folder of your hoster. That is the simplest upload, via FTP or using rsync. Most “conventional” hosters offer FTP/SFTP/SSH access to your site and you can upload things in a post-build step.
I use IONOS too. Here’s what I did/do:
- Created a SFTP/SCP/SSH account (should be right in the panel somewhere)
- Took note of the username and password (username should be something like u########), as well as the node/login domain (should be something like home#########.1and1-data.host)
- Logged in via SSH, and created a folder
- Pointed the domain to the folder for the site (in domain settings from IONOS Portal)
- Created a .ssh folder in the login root, then copied the contents of my id_…pub (“public” key) from my computer’s .ssh folder (you can create it using ssh-keygen command, follow the prompts (I would recommend putting a decent passphrase on it), then it should be in your .ssh folder ~ or Users/username)
- Installed rsync on my computer
- Wrote a shell script to upload from Linux (when I was on Windows I just did this part from a WSL terminal). I’ll put its template below, you’ll have to mod it for your username and node, replacing the #'s and SiteFolder to your folder. I also had to run “chmod +x uploadscript.sh” to make it executable, first.
- The only part you have to do after making changes, is run “./uploadscript.sh” and it will just take care of it for you.
uploadscript.sh
#!/bin/bash
hugo
rsync -aP --delete public/ u########@home#########.1and1-data.host:SiteFolder
rm -r public
1 Like