From the course: Learning Static Site Building with Hugo

Deploy via FTP overview

From the course: Learning Static Site Building with Hugo

Start my 1-month free trial

Deploy via FTP overview

- [Instructor] If you have an existing web server or web hosting plan that you'd like to host your static site on, deploying the FTP is a good choice. Publishing your static site to an FTP server is essentially the same as using an FTP client to manually copy the site files yourself. We'll automate this process using Travis CI. Here's how it'll work. When you make changes to your site files and push them up GitHub, Travis CI automatically runs a build script. We'll modify this build script to push the site content up to your FTP server so it can be served to your visitors. You'll need to gather some information to get started. First, determine whether your web host supports SFTP, also known as secure FTP, or SSHFTP. This course uses SFTP because it's more secure than plain or unencrypted FTP. Your web server will need to support SFTP to follow these instructions. For some hosts, you'll need to turn this feature on in the hosting control panel. Next, you'll need to gather the SFTP connection information for your web server, the host or server name, the port, and your connection username and password. If you need help finding this information, look at the documentation for your web server, or contact your hosting company. I'd recommend downloading the FileZilla tool to test the connection. This will ensure your connection information is correct, and it will let your browse the contents of your FTP server. Most servers have a public underscore HTML folder which is the base directory for the files that will be served to the public. This is where we'll copy the static site files during the deployment process. To perform the deployment, we'll write a deployment script that Travis will run right after it builds the site. You can write this deployment script in any language you're comfortable in, but I'll demonstrate how to do it in JavaScript. The deployment script will connect to the FTP server, remove any old files from the last deployment, and copy the updated files that were just built. Alright, let's get started.

Contents