Implementing a Modern WordPress Workflow on Alibaba Cloud — Part 1

  1. Part 1 — Provision and Secure an Ubuntu 16.04 server
  2. Part 2 — Completing the LEMP stack
  3. Part 3 — Configuring your Domain and Let’s Encrypt SSL
  4. Part 4 — Installing WordPress
  5. Part 5 — Using DirectMail for Transactional Email

Step 1. Create Your Staging Site Database

Login to your server by SSH, (remember to replace my superuser and domain with your own):

$ ssh new_user@another-example-domain.com
$ sudo mysql -u root -p
CREATE DATABASE staging DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON staging.* TO 'new_user'@'localhost' IDENTIFIED BY 'new_users_password';
FLUSH PRIVILEGES

Step 2. Configure Your Staging Site Subdomain and DNS

Log in to your Alibaba Cloud Console Home and visit the Alibaba Cloud DNS panel by clicking on its link in the ‘Domains & Websites’ section of the main ‘Products & Services’ panel:

Step 3. Configure NGINX to Serve Your Staging Site Subdomain

On your server, copy the Nginx configuration file for your main production domain, and rename it to your staging subdomain’s name:

$ sudo cp /etc/nginx/sites-available/another-example-domain.com /etc/nginx/sites-available/staging.another-example-domain.com
$ sudo ln -s /etc/nginx/sites-available/staging.another-example-domain.com /etc/nginx/sites-enabled/staging.another-example-domain.com
$ sudo nano /etc/nginx/staging.another-example-domain.com
root /var/www/another-example-domain.com;
server_name another-example-domain.com www.another-example-domain.com;
root /var/www/staging.another-example-domain.com;
server_name staging.another-example-domain.com;
$ sudo nginx -t
$ sudo systemctl reload nginx

Step 4. Issue Let’s Encrypt SSL Certificate for Your Staging Site Subdomain

If you have already installed Certbot, please ignore the next section and move ahead to the following section. Alternatively, if you are not interested in the recommended security of using HTTPS and enjoying the additional benefits of HTTP2, then please ignore this step entirely and move ahead to Step.5.

$ sudo apt-get install -y software-properties-common
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-nginx

If you have already installed Certbot

Assuming you previously installed the Let’s Encrypt Certbot to issue the SSL certificate for your main site domain, it is very easy to repeat the process and issue a separate certificate for your staging site subdomain.

$ sudo certbot --nginx -d staging.another-example-domain.com
$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
$ sudo nano /etc/nginx/sites-available/staging.another-example-domain.com
ssl_dhparam /etc/ssl/certs/dhparam.pem;
$ sudo nginx -t
$ sudo systemctl reload nginx

Step 5. Create Your WordPress Staging Site Directory

We have not yet created a site root directory for our Staging site within the /var/www/ directory. This is because how we create this directory will depend on the method we use to complete the installation of the Staging Site.

  1. Part 2 — Create the Staging & Local sites Using Duplicator and SFTP
  2. Part 3 — Create the Staging & Local sites Using the Terminal and WPCLI

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com