You must be
root
to follow the steps in this guide.
- Download and Install MariaDB. MariaDB is used in place of MySQL.
sudo apt-get install mariadb-server mariadb-client
- Set it up to run on boot.
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
- Run configuration.
sudo mysql_secure_installation
The choices you should choose are as follows:
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- Remove anonymous users? [Y/n]: Y
- Disallow root login remotely? [Y/n]: Y
- Remove test database and access to it? [Y/n]: Y
- Reload privilege tables now? [Y/n]: Y
- Restart MariaDB.
sudo systemctl restart mariadb.service
- Enter the MariaDB client.
CREATE USER 'mysqlConnectionUserName'@'localhost' IDENTIFIED BY 'new_password_here';
GRANT ALL ON * TO 'mysqlConnectionUserName'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;
FLUSH PRIVILEGES;
- At this point you may want to import your SQL database for any websites you want to use. While still in the MariaDB client you can run the following to import
.sql
files.
source ./example.sql;
- Once done you can leave the client.
EXIT;
You must be
root
to follow the steps in this guide.
- Download and install Node.js and PHP.
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs php
sudo apt install php-fpm php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-mcrypt php-ldap php-zip php-curl php-cgi
- Install Process Manager for Node.js Scripts.
npm install pm2 -g
- Create a directory for the website and enter it.
mkdir /home/wordpress
cd /home/wordpress
- Download
runPhpSite.js
into the current directory. You should be in/home/wordpress
.
wget https://gist.githubusercontent.com/moeiscool/876e64a9725fa07ac9e6852e1001f1d5/raw/e4a8c72721e48c13a22a6894a56e766481fa5eed/runPhpSite.js -O runPhpSite.js
- Install
node-php
npm install node-php
- Put the PHP website inside a folder called
public
. The full path should be/home/wordpress/public
. Your folder structure should be similar to the following.
- home
| - wordpress
| |- runPhpSite.js
| |- public
- Run the website and it should be on port 80.
pm2 start runPhpSite.js
- Checking logs for the wbsite can be done by running.
pm2 logs --lines 100
- Restarting the webserver can be done by running.
pm2 restart runPhpSite