Deploying WordPress
Deploying wordpress¶
create an instance¶
- Follow the "Getting Started" instructions here to create an Ubuntu instance, keypair, security group, and to connect to your instance using SSH.
- Create an instance that fits your website's resource demand. For this example, we will use a small instance (ec1.small with 20GB). Depending on the number of concurrent visitors, this is sufficient for most small/medium websites.
- For your Security groups, the ports used by WordPress are 80 & 443 (http & https)
- Create a DNS A record to point your domain to your assigned IP, this might take some time and is needed later for SSL/HTTPS
setting up requirements¶
-
update your instance
-
Download requirements
- reboot your instance (in case of kernel changes)
sudo reboot - ssh back into your instance
Create an SQL database¶
- set a root password for mysql replace "my_supersecure_pwd" with your preferred pasword
- exit mysql:
- run the secure installation procedure:
- enter the root password you set before (excluding the '')
- Choose wether you want the 'VALIDATE PASSWORD COMPONENT' this is adviced, however for this tutorial we choose not to enable it
- Choose whether you want to keep or change the root password
- Choose 'Y' to remove the anonymous user
- Since you are connecting over SSH choose 'N' for disallowing remote root login
- Choose 'Y' for removing the test database
- And a final 'Y' to reload the privilege tables
- login to mysql:
- create a database for your site, replacing 'MY_WEBSITE' with your preferred database name
- create a separate mysql user & user password by replacing "MY_USER" and "MY_PWD"
- Grant your new user access to your database, make sure you replace the fields
- apply privileges and exit mysql:
Configure apache2¶
- enable your site in apache2 enable the rewrite module restart apache2
download wordpress¶
- go to your temporary folder
- download wordpress
- extract the package
- create some files and folders to avoid permission issues later
- copy the wordpress folder to your webroot
- change ownership of your webroot to the 'www-data' user and group
- use the wordpress keygen to create some secure keys for your config file by opening the following page in your browser:
- copy these keys & edit the config file
- Scroll down until you find the example keys. Remove the examples and copy your newly generated ones in their place.
- Now scroll up until you find the 'Database settings' section and fill in the variables you entered earlier in the mysql section of this tutorial
- Close the config file with 'ctrl+x' followed by 'y' and 'enter'
- remove the apache2 default index file
finish wordpress installation¶
- in your browser visit your URL and follow the installation steps
Get a certificate¶
- in your SSH session install certbot
- make sure certbot can work outside it's snap
- get a certificate by running this command and following the steps
Finished!¶
Your wordpress site is now fully operational and can be reached at https://yourdomain