The fastest way to host Wordpress on a VPS and make it publicly accessible. Includes backup and restore scripts.
Running setup.sh
installs Docker and docker-compose, creates all necessary folders, then builds and starts the following applications using Docker:
- Wordpress [port 3070/8081]
- Nginx Proxy Manager [port 80/81/443]
- Portainer [port 9000]
Each application runs in a Docker stack using docker-compose. Each container's data is persisted using docker volume bind mounts. The /home/administrator/backups
folder contains all backups.
The setup process consists of BOTH an initial automated setup script and a series of manual steps.
- Ubuntu 20.04 LTS server with at least 1GB of RAM and 20GB of storage
root
user
sudo useradd -m -p $(openssl passwd -1 [NEW PASSWORD]) administrator
cd /home/administrator
git clone https://github.com/tom-leamon/wordpresto.git
cd wordpresto
nano .env
to set a unique, secure password for the Wordpress and Nginx Proxy Manager databases. You can also change the Docker container ports.sudo sh setup.sh
orsudo sh setup_docker-already-installed.sh
if Docker is already installed on the machine.- Follow the manual steps specified below.
- Visit
localhost:9000
- Create new account with username
administrator
-
Visit
localhost:81
-
Log in as the default admin user
Username
Password
changeme
-
Change the default login email and password
Learn more about Ngnix Proxy Manger.
You can transfer the backup data from one environment to another.
-
[optional] Run this command on the host you want to copy data from, and specify the host IP address that you want to copy the backups to.
sh /home/administrator/wordpresto/scripts/transfer-all-backups.sh [host ip address]
-
Copy database backup .sql file to
/home/administrator/backups/wordpresto/database/wordpresto-wordpress-db_latest.sql
-
Restore the database by running
sudo sh /home/administrator/wordpresto/scripts/restore/restore-db.sh
-
Copy upload backup tar file to
/home/administrator/backups/wordpresto/wp-content/wordpresto-wordpress-wp-content_latest.tar
-
Restore the uploads by running
sudo sh /home/administrator/wordpresto/scripts/restore/restore-wp-content.sh
You can develop your WordPress website locally before transfering it to the production server.
For Linux users, you can use the same non-local scripts that are used in production. If you are using Windows or MacOS, use the following scripts.
-
For local development, only WordPress, the WordPress DB, and PHPMyAdmin containers are started.
sh scripts/start_local.sh
Locally, backups will be saved in to ./backups
-
Backup the WordPress database
sh scripts/backup/backup-db_local.sh
-
Backup wp-content
sh scripts/backup/backup-wp-content_local.sh
-
Copy the database backup .sql file to
./backups/wordpresto/database/wordpresto-wordpress-db_latest.sql
-
Restore the database by running
sh ./wordpresto/scripts/restore/restore-db_local.sh
-
Copy upload backup tar file to
./backups/wordpresto/wp-content/wordpresto-wordpress-wp-content_latest.tar
-
Restore the uploads by running
sh ./wordpresto/scripts/restore/restore-wp-content_local.sh
Avoid SSH errors after rebuilding a VM you previously connected to. Use this command to remove entries from known_hosts:
ssh-keygen -R hostname
Make sure the firewall is allowing connections from your IP.