📝How to Install Wordpress on Server and Configuration Virtual Host

How to Install Wordpress on Server and Configuration Virtual Host

Introduction

WordPress is a Content Management System (CMS) launched by Matt Mullenweg and Mike Little in 2004. As a CMS, WordPress can help you create and manage websites without coding. You can organize the appearance, add features, and create content on your website easily. So, it is suitable for use even by beginners. Not only that, you can also use WordPress for free because it is open-source. Currently, WordPress is used by more than 455 million websites. CyberPanel is the web panel that we will use in this handout because it is free, easy to use and has complete features. One of them is the WordPress Auto Installer feature which allows us to install with one click. How to ? let's follow these steps.


Configuration

Install Package

apt install php7.3 php7.3-mysql mariadb-server unzip

Configuration Database

Set Password for User Root

mysql_secure_installation
Enter current password for root (enter for none): 123
Set root password? [Y/n] y
New password: 123
Re-enter new password: 123
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

Create Database

mysql -u root -p
CREATE DATABASE db_pemula;
CREATE USER 'rizwanpemula'@'localhost' IDENTIFIED BY '123';
GRANT ALL PRIVILEGES ON *.* TO 'rizwanpemula'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Create Directory For Wordpress

mkdir /var/www/wordpress
mkdir /var/www/wordpress/log

Change Permission

chmod 777 /var/www/wordpress

Go to Wordpress Directory

cd /var/www/wordpress

Install Package Wordpress

wget https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress/* .

VirtualHost

Virtual host is a configuration on a web server that allows you to use more than one domain on a server. With a virtual host you can create more than one website with different content on a server.

Create Directory for PHP

mkdir /var/www/php
mkdir /var/www/php/log

Create File php.info

nano /var/www/php/index.php
<?php
phpinfo();
?>

Create File VirtualHost

VirtualHost

nano /etc/apache2/sites-available/php.conf
nano /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
    ServerName php.rizwanpemula.com
    DocumentRoot /var/www/php
    ErrorLog /var/www/php/log/error.log
    CustomLog /var/www/php/log/requests.log combined
</VirtualHost>

Enable File VirtualHost

a2ensite wordpress.conf
a2ensite php.conf

Restart Service

systemctl reload apache2

Configuration is Completed

Setup Wordpress

wordpress.rizwanpemula.com

Database Name : db_pemula
Username : rizwanpemula
Password : 123
Database Host : localhost
Table Prefix : wp_
Site Title : wp-pemula
Username : rizwan
Password : 123
*confirm use of weak password
Your Email : [email protected]

Last updated