Once you have your files ready to share with the world, your next step is to deploy them, which is a fancy way of saying "lets save these files on a server so other people can access them". Here I'll go through a few different options of accomplishing this:
Uploading the file to the server using cPanel
The most common way for new web developers to push their files to the server is using the file manager built into cPanel. This allows you to select which files to upload. While this is reliable, it's a very manual process to upload new files or overwrite files when something changes.
FTP
FTP stands for File Transfer Protocol, and it is a way for your computer to make a connection to the server, allowing you to upload, overwrite, and delete files on a remote server. For all the below methods, you will first want to setup an FTP login in your cPanel by going to Files -> FTP Accounts. Create a new FTP account and store the username and password, you will need these to setup the FTP client below.
FTP using PHPStorm
In PHPStorm, under Preferences -> Deployment -> Add, you can setup an FTP connection to the server.
For type you can use FTP
Host should be your domain name, port 21
Enter the username and password you setup on cPanel
Next, under the Mappings tab, you can setup the local path and deployment path. If you want files uploaded to the root of your server, you can just use "/" for Deployment path.
If you are working on a subfolder of your website (like mywebsiteblog.com/blog) then you can set the deployment path for /blog to have all the files in your folder pushed to that subfolder.Back to PHPStorm Preferences -> Deployment -> Options, I like to set the Upload changed files automatically to the server to "On Explicit Save", which gives you the Save to deploy functionality.
FTP using FileZilla/CyberDuck
An honorable mention here, these FTP clients allow you to more easily sync files between the server and your computer than the cPanel file manager, but still take some manual work.
SSH
The modern more secure way to connect to a server, there is a solid tutorial for setting up SSH here
Using Git
New platforms like Vercel and Netlify allow you to select a git repository, and whenever a commit is pushed to the main branch, it automatically builds the new files, then copies the build folder to the server.
Top comments (0)