WordPress Installation Guide for PRQ VPS Service!
In this guide you need to have user and ROOT (admin) access to the server!
If you are totally new to this you need a SSH client. For Mac and such use google to find a equal tool. We are recommending a free SSH client called PuTTy, It’s a simple SSH client to access the shell and to be able to administrate your server can be found here:
PuTTy 64bit
PuTTy 32Bit
login with you user account, and then use the ‘su -‘ command to obtain root (administrator) to start installing the essential components for the server. This should be fairly straight forward.
we choose to use LEMP configuration with NGINX.
Please fallow these steps. To make sure some prerequisite are installed just do these commands:
apt update
apt upgrade -y
apt install curl
(1) Starting with the Web server.
installation:
apt install nginx
directory for your website:
mkdir -p /var/www/html/mydomain.com
configure your website:
rm -rf /etc/nginx/sites-enabled/default
(to disable the default configuration by removing a symlink to the default configuration, if not done before.)
Make a configuration file for the NGINX website:
nano -w /etc/nginx/sites-available/mydomain.com.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name domain.com www.mydomain.com;
root /var/www/html/mydomain.com;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
(copy and paste this in to you new configuration file. ctrl+o save the file, ctrl+x to exit.)
now to enable the sites configuration:
ln -s /etc/nginx/sites-available/mydomain.com.conf /etc/nginx/sites-enabled/
then we need to make index file:
nano -w /var/www/html/mydomain.com/index.html
<html>
<head>
<title>Index Page</title>
</head>
<body>
<h1>Great job you got it working!</h1>
</body>
</html>
(copy and paste this in to you new configuration file. ctrl+o save the file, ctrl+x to exit.)
Now we reload NGINX:
nginx -s reload
Now you should be able to go to your “mydomain.com” with a web browser and view the message displayed in the index.html we created before. If this fails then please go back and see what you missed potentially.
(2) Install SSL support with Lets Encrypt
please visit: https://certbot.eff.org/ for more information.
apt update
apt install snapd
Either log out and back in again, or restart your system, to ensure snap’s paths are updated correctly.
sudo snap install core; snap refresh core
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
certbot --nginx
(you got a few choices here, but they are pretty forward, like your email and if you wanna enable the domain and such.)
certbot renew --dry-run
(to test it renews the certificate)
also if you visit mydomain.com with your browser, you will see that the lock is on and you got SSL enabled.
(3) Install PHP
Lets install latest version of PHP 7.4 (at time of writing.)
apt -y install lsb-release apt-transport-https ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php7.4.list
apt update
apt install php7.0-fpm php7.0-json php7.0-opcache php7.0-mysql php7.0-xml php7.0-mbstring php7.0-cli php7.0-fpm php7.0-gd php7.0-curl
php -v
(To confirm you installed pvp and what version, should be 7.0)
4) MariaDB (MySQL) installation and making user for the database
apt install mariadb-server
mysql -V
(output should be like this: mysql Ver 15.1 Distrib 10.3.8-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2)
systemctl status mariadb
(To check the MariaDB is working.)
mysql_secure_installation
(Do remember what you choose and then when asked for lighthttp and apache just leave blank and continue.)
mysql -u root -p
(use the password for user/root that you where assigned or have changed to.)
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
(To create the database, “wordpress” is the name of the database, you may change it to something else like “mydomwp” if you like.)
GRANT ALL ON wordpress.* TO ‘wordpressuser’@’localhost’ IDENTIFIED BY ‘enter-password-here’;
(You have to remember here that wordpress.* should be changed to “mydomwp.” if you did not want the standard wordpress name for database. “wordpressuser” is the username for the database for you wordpress and you can change this what you like, also the “‘enter-password-here'” just change the: enter-password-here to something else, example: GRANT ALL ON mydomwp. TO ‘awesomeuser’@’localhost’ IDENTIFIED BY ‘ras314saOIJFTG.’; this is a example only.)
FLUSH PRIVILEGES;
EXIT;
5) install WordPress
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cp -a /tmp/wordpress/. /var/www/html/mydomain.com
chown -R www-data:www-data /var/www/html/mydomain.com
curl -s https://api.wordpress.org/secret-key/1.1/salt/
(out put should be similar to this.)
define(‘AUTH_KEY’, ‘m=w)!7{-EEc&JYU~$wd@jTrqFseaZ0D-4Vd/?!>_hcFBmQ+S2Do!QP>>O-|OI21′); define(‘SECURE_AUTH_KEY’, ‘S?lk-{RG 5K~sd1$Ni8?IA#h/.@?6MezjmoBWm&&b+h1YP?T.]Y=&^h9[BmThdbJ5zepb824LUd;-'); define('NONCE_KEY', 'cPim1L6}H1rQLtLj|FrN1DO:LZVsh
rr}5 }k,f~%u)papX4|_J^Q%PKJ44uF[l'); define('AUTH_SALT', ',+Aa_iZ/%yj5?-0F.O>Ogd6jCLU+2_2M$+1Zo-hUog70lLa$)YI@wbzkN<~v!Acd'); define('SECURE_AUTH_SALT', '-9sQ8iLS}1-iEX)b<A6(JNuPIGv2SV5ZiHV])4i+@oi6FG76$4{A@c*fj8[ *Uc-'); define('LOGGED_IN_SALT', 'K$i5b^g?TK4M|w;mqlh>m9ZJ5eVAq0X;we}jvw:JNkKm-O|-=GdH-{I><
J(ZgKB’);
define(‘NONCE_SALT’, ‘c_VY?z=E}2r0A&r!F/qkrtM3>K-Id+zqG*^2g#4/-sR2%GP>b|{<97nL4uP8K/’);
copy the key YOU generated not the example.
nano -w /var/www/html/mydomain.com/wp-config.php
Then replace the key you generated, and while at it edit these lines and add the information for the database:
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define( ‘DB_NAME’, ‘database_name_here’ );
/** MySQL database username */
define( ‘DB_USER’, ‘username_here’ );
/** MySQL database password */
define( ‘DB_PASSWORD’, ‘password_here’ );
Also add this at the end:
define(‘FS_METHOD’, ‘direct’);
save and quit
Now we are going to do the last step and enable and go online with wordpress.
nano -w /etc/nginx/sites-available/mydomain.com.conf
remove all old text and copy and paste this and edit the right domain name.
server {
listen 80;
server_name mydomain.com;
return 301 https://mydomain.com$request_uri;
}
server {
listen 443 ssl http2;
server_name mydomain.com;
root /var/www/html/mydomain.com;
index index.php;
# SSL parameters
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/mydomain.com/chain.pem;
# log files
access_log /var/log/nginx/mydomain.com.access.log;
error_log /var/log/nginx/mydomain.com.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
save and exit
systemctl restart nginx
go to the site mydomain.com and then just fallow the directions!
enjoy!