Pushing to a Production Server
This guide walks you through the process of deploying a WordPress website to a production server, including backing up your development site, configuring hosting, setting up DNS, and establishing GitHub deployment workflows.
-
Backup Development Site:
- Install a backup plugin, AkeebaBackup, and create a backup of the development site as a ZIP archive. Save it to your computer.
-
Create New Hosting within Synergy (if required):
- Upload the website ZIP to the necessary directory and extract it.
- Create a MySQL® database and user with full permissions.
- Create FTP details for hosting or use the default hosting FTP account (found within service details on Synergy).
-
Point Domain DNS to Production Server:
- Ensure the domain is pointing directly to the new hosting. If not, set up your local DNS to temporarily point to the hosting to view the website.
- Modify Hosts File:
- Open Terminal.
- Run the following command to edit the hosts file:
sudo nano /etc/hosts - Enter your password when prompted.
- Add a new line with the server's IP address followed by the domain name, e.g.:
123.456.789.012 domain.com - Save the changes by pressing
CTRL + O, then pressEnter. - Exit the editor by pressing
CTRL + X. - Flush the DNS cache to apply changes:
sudo dscacheutil -flushcache
- Ensure the domain is pointing directly to the new hosting. If not, set up your local DNS to temporarily point to the hosting to view the website.
-
Continue with WordPress Setup:
- Run through the WordPress setup. If using AkeebaBackup, go to
https://domain/installationand complete the setup. - Save the login credentials to Bitwarden.
- The site will now be set up on new hosting, but you need to link your repository to the hosting for quick deploys.
- Run through the WordPress setup. If using AkeebaBackup, go to
-
Configure GitHub Repository:
- Paste the FTP password inside
SETTINGS > SECRETS > ACTIONSin GitHub. - Name the secret
PROD_FTP_PASS.
- Paste the FTP password inside
-
Prepare Codebase on Local Computer:
- If not on the main branch already, switch to the main branch and merge the develop branch into main.
- Go to your
deploy.yamlfile inside.github > workflows. - Add the correct FTP details and use
{{ secrets.PROD_FTP_PASS }}for the password. - Ensure the correct directory is added (must end with
/). - Commit to the main branch and view the progress of the commit within the GitHub Actions tab. Resolve any errors if necessary.
- Once completed successfully, the codebase will be connected to the hosting.
-
Configure Hosting:
- Go to the file manager within the hosting and configure the newly generated
.envfile with the database credentials.
- Go to the file manager within the hosting and configure the newly generated