How to install WordPress on VPS
Install WordPress LAMP stack on VPS.
STEP 1
Install Apache
$ sudo apt update$ sudo apt -y install apache2
$ sudo systemctl restart apache2
ЁЯСЙ Go to your IP Address to make sure Apache installed correctly
STEP 2
Install PHP
$ sudo apt -y install php libapache2-mod-php$ php -v
$ sudo systemctl restart apache2
STEP 3
Open ports for HTTP and HTTPS / Firewall settings
$ sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 80 -j ACCEPT$ sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 443 -j ACCEPT
$ sudo netfilter-persistent save
SETP 4
Create Virtual Host on Apache (eg. example.com)
$ sudo mkdir -p /var/www/example.com/public_html$ sudo chown -R www-data: /var/www/example.com/public_html
OR
$ sudo chown -R ubuntu /var/www/example.com/public_html
$ sudo nano /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80> ServerName example.com ServerAlias www.example.com ServerAdmin support@example.com DocumentRoot /var/www/example.com/public_html <Directory /var/www/example.com/public_html/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog /error.log CustomLog /access.log combined </VirtualHost>$ sudo a2ensite example.com
$ sudo apachectl configtest
$ sudo a2enmod rewrite
$ sudo systemctl restart apache2
SETP 5
Install and secure MyDQL
$ sudo apt install mysql-server$ sudo mysql_secure_installation
MySQL>
1] sudo mysql -u root -p
2] CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
3] CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'yourpassword';
4] GRANT ALL ON wordpress.* TO 'userasia'@'localhost';
5] FLUSH PRIVILEGES;
6] EXIT;
STEP 6
Download and Install WordPress
$ cd /var/www/example.com/public_html$ curl -O https://wordpress.org/latest.tar.gz
$ tar xzvf latest.tar.gz
$ cd /var/www/example.com/public_html/wordpress
$ sudo cp -a . /var/www/example.com/public_html
ЁЯСЙ Create .htaccess file using filezilla
ЁЯСЙ Create 'wp-config' file using filezilla
ЁЯСЙ Create 'upgrade' directory at - /wp-content/upgrade
$ sudo find /var/www/example.com/public_html -type d -exec chmod 750 {} \;
$ sudo find /var/www/example.com/public_html -type f -exec chmod 640 {} \;
$ curl -s https://api.wordpress.org/secret-key/1.1/salt/
Copy the output you received now. Open the WordPress configuration file via Filezilla and paste it into the config file as required.]
*********************************************
A BIG QUESTION?
*********************************************
$ sudo chown -R $USER:$USER /var/www/example.com/public_html
$ sudo chown -R www-data:www-data /var/www/example.com/public_html
$ sudo chown -R www-data: /var/www/example.com/public_html
$ sudo chown -R ubuntu /var/www/example.com/public_html
$ ls -la
STEP 7
Install PHP Extensions for WordPress
WordPress and many of its plugins leverage additional PHP extensions. We can download and install some of the most popular PHP extensions for use with WordPress by typing:
$ sudo apt update$ sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php-mysql
STEP 8
INSTALL LET'S SSL CERTIFICATE ON APACHE
$ sudo apt install certbot python3-certbot-apache$ sudo certbot --apache -d example.com -d www.example.com
$ sudo systemctl restart apache2
STEP 9
Install PHPmyAdmin
$ sudo apt update$ sudo apt install phpmyadmin
→ db-config? No
→ Select 'Apache'
$ sudo phpenmod mbstring
$ sudo service apache2 reload
NOTES:
Make sure to manage 'root' user for security reason - with disable or strong password
You can login with your Dbase uname and pwTROUBLESHOOT
****************************************************
If Permalinks gives you pain in your ASS
****************************************************
.htaccess
$ sudo chown www-data .htaccess
$ sudo chmod 660 .htaccess
Add Virtual Host File to - /etc/apache2/sites-available/ (both HTTP and HTTPS)
<Directory /var/www/example.com/public_html> AllowOverriding </Directory>Also check
$ Sudo a2enmod rewrite
Post a Comment
0 Comments