Last week, my colleague asked me to set up a Wordpress server, and I remember how painful to setup it many years ago. It requires MySQL and PHP. Therefore, it may introduce many security leaks. My website at the moment still can receive Wordpress attack.
Today, I discovered a rapid solution to set up a Wordpress server using Docker, and it also solves the problem with Let’s Encrypt.
Let’s check it out.
Before we start, if you haven’t configured your DNS, please go to DNS manager, setup A record for @
and www
and point them to the server, then we can start.
Step1: Install Docker and Docker-Compose
If you argue, I could have use Kubernetes? Well, you can if you like. I did this for my colleague, which doesn’t profit myself much :)
|
|
Step 2: Store everything in a directory
|
|
Step 3: Setup WebProxy
Many thanks to @evertramos, he did everything for setting up the webproxy:
|
|
Replace .env
with the following content:
|
|
Then strat the script:
|
|
If you want to configure more options, please check out his repository.
Step 4: Setup Wordpress
Again, thanks to @evertramos, he did everything for setting up the Wordpress:
|
|
Also, set up an .env
file and change to corresponding configs:
|
|
Then, we are ready to go:
|
|
Step 5: Setup SFTP
Note that in Wordpress, you will need to set up an SFTP server for the plugin and theme installation.
Activate an SFTP server that dedicated for the Wordpress, the first step is to secure the folder you open to the public:
|
|
Then you need to enable the SFTP in SSH config, to edit the configuration, you need:
|
|
Then put the following information to the config file:
|
|
Then restart the server:
|
|
To use SFTP group, you need:
|
|
Done, and have fun :)