By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.
This is second part of my tutorial about how to install ProcessWire CMS on Debian 9.
In the previous tutorial, we have set up a LAMP stack and other required packages for ProcessWire. In the second part of the tutorial, we will install ProcessWire on our Alibaba Cloud Elastic Compute Service (ECS) instance.
But before doing that, we will need to configure our domain. We will also secure the domain with Let's Encrypt (SSL). After that, we will create a database and then finally install ProcessWire CMS on our ECS instance.
If you bought your domain from Alibaba Cloud, it will automatically setup DNS records. You will only require to add domain to Alibaba Cloud DNS. In case, if you have already registered domain from any other registrar, you will need to add that domain in Alibaba Cloud DNS and update its nameserver records on your registrar account. Once your DNS records are propagated, check them from intodns.com.
To setup domain name bought from a third party, follow the steps below:
# sudo nano /etc/apache2/sites-available/imarslan.com.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin itsaareez@example.com
ServerName imarslan.com
ServerAlias www.imarslan.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/
# Log file locations
LogLevel warn
ErrorLog /var/www/html/error.log
CustomLog /var/www/html/access.log combined
</VirtualHost>
After adding the text, use Ctrl + X, then press 'Y', then hit Enter key to save the file
# sudo systemctl restart apache2
Note: The above configurations of virtual host are for HTTP protocol. To setup HTTPS protocol, you will have to install SSL. To install SSL and allow HTTPS to provide a secured experience to your users, you will need to install Let's Encrypt. Let's Encrypt will provide you free SSL for your domain.
# sudo systemctl stop apache2
# echo 'deb http://ftp.debian.org/debian jessie-backp orts main' | sudo tee /etc/apt/sources.list.d/backports.list
# sudo apt-get update
# sudo apt-get install python-certbot-apache -t jessie-backports
You will be prompted whether you want to continue or not. Type 'Y' and hit Enter.
# sudo certbot --authenticator standalone --installer apache -d imarslan.com -d www.imarslan.com \
--pre-hook "systemctl stop apache2" \
--post-hook "systemctl start apache2"
Note: Remember to replace imarslan.com with your own domain name.
# sudo nano /etc/apache2/sites-available/imarslan.com.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName imarslan.com
ServerAdmin itsaareez@example.com
ServerAlias www.imarslan.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/imarslan.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/imarslan.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/imarslan.com/chain.pem
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/
# Log file locations
LogLevel warn
ErrorLog /var/www/html/error.log
CustomLog /var/www/html/access.log combined
</VirtualHost>
</IfModule>
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin itsaareez@example.com
ServerName imarslan.com
ServerAlias www.imarslan.com
Redirect permanent / https://www.imarslan.com/
# Log file locations
LogLevel warn
ErrorLog /var/www/html/error.log
CustomLog /var/www/html/access.log combined
</VirtualHost>
Replace imarslan.com with your domain name. This above code will force SSL and all of the traffic will be redirected to HTTPS version of the website.
# sudo mysql -u root -p
CREATE DATABASE pw_db CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'pw_db'@'localhost' IDENTIFIED BY 'Password';
GRANT ALL PRIVILEGES ON pw_db.* TO 'pw_db'@'localhost';
FLUSH PRIVILEGES;
EXIT;
where pw_db can be changed to your desired name
# sudo a2dissite *default
# sudo a2ensite imarslan.com.conf
# sudo systemctl reload apache2
Note: In case, if you get any error like 'No such directory or file', then create html directory. To do so, navigate to cd /var/www and execute the following command to create html directory and type cd html and hit enter.
# sudo mkdir html
# ls -li
You will see the files shown in above screenshot. You will need to remove default index.html page of Apache
# sudo rm -r index.html
# sudo wget https://github.com/processwire/processwire/archive/master.zip -O ProcessWire.zip
# ls -li
# sudo unzip ProcessWire.zip
# sudo mv ./processwire-master/* /var/www/html
# sudo chown -R www-data:www-data *
# sudo systemctl restart apache2
Congratulations! Now it's time to access your ProcessWire CMS. Just open website in your browser. In my case, I will open www.imarslan.com. Now we will proceed towards completion of installation of ProcessWire CMS which will involve different settings.
1.Default (Beginner Edition)
2.Default (Intermediate Edition)
3.Multi-Language
4. Blank
5. Classic
That's it! You have successfully installed ProcessWire CMS on Alibaba Cloud ECS.
You can access your admin panel by using the admin panel URL you have configured. If you have followed my values, you can access using https://www.yourdomain.com/admin . To view your website, you can simply access it through https://www.yourdomain.com.
How to install ProcessWire CMS on Debian 9 – Part 1 LAMP Stack Installation
How to Install Pagekit CMS on CentOS 7.4 – Part 1 LAMP Stack Setup
2,599 posts | 762 followers
FollowAlibaba Clouder - May 18, 2018
Alibaba Clouder - May 22, 2018
Alibaba Clouder - February 27, 2019
Alibaba Clouder - May 21, 2018
Alibaba Clouder - February 12, 2019
francisndungu - December 12, 2018
2,599 posts | 762 followers
FollowElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreAn encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreLearn More
More Posts by Alibaba Clouder