- Install Apache
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 -y - Install PHP
sudo apt install php libapache2-mod-php php-mysql -y
MARIA DB Installation
MYSQL
sudo apt install mysql-server -y
sudo mysql_secure_installation
sudo apt install mariadb-server
sudo mysql_secure_installation
if show errors, when you install database. if sucessfully install then flow next section “database create”
solved it by running “$sudo mysql”
which logged me in as root without a password, then I ran
$ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password by ‘mynewpassword’;
$ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password by ‘4Hxla]h!@/8gjEWY’;
Database create
sudo mysql -u root -p
CREATE DATABASE wpdb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER ‘wpuser’@’localhost’ IDENTIFIED BY ‘BNlerp4@38%4o^G7’;
mysql> CREATE DATABASE wpdb;
mysql> CREATE USER ‘wpuser’@’localhost’ IDENTIFIED BY ‘BNlerp4@38%4o^G7’;
mysql> GRANT ALL ON wpdb.* TO ‘wpuser’@’localhost’;
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
Flow the command for a single website. For multi websites follow the next section command
cd /var/www/html
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xzf latest.tar.gz
sudo mv wordpress/* .
sudo chown -R www-data: .
cp wp-config-sample.php wp-config.php
nano wp-config.php
sudo systemctl reload apache2
Follow the command for 2+ websites===Ignore this command, if you want to configure a single website.========================
No:1# WordPress
cd /var/www
sudo mkdir site1
cd site1
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xzf latest.tar.gz
sudo mv wordpress/* .
sudo chown -R www-data: .
3.3 Apache configuration
cd /etc/apache2/sites-available/
sudo cp 000-default.conf site1.conf
nano site1.conf
ServerName netvnsite1.tk
ServerAlias www.netvn.site1.tk
DocumentRoot /var/www/site1
a2ensite site1.conf
a2dissite 000-default.conf
systemctl reload apache2
4.2 WordPress
cd /var/www
sudo mkdir site2
cd site2
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xzf latest.tar.gz
sudo mv wordpress/* .
sudo chown -R www-data: .
4.3 Apache configuration
cd /etc/apache2/sites-available/
sudo cp 000-default.conf site2.conf
sudo nano site2.conf
ServerName netvnsite2.tk
ServerAlias www.netvnsite2.tk
DocumentRoot /var/www/site2
sudo a2ensite site2.conf
sudo systemctl reload apache2
- Port Forwarding
80,443
ufw allow 80
ufw allow 443
============================================ssl========================= - HTTPS
sudo apt install python3-certbot-apache -y
sudo certbot –apache -d -d www.domain
sudo certbot –apache -d huskyfurniture.com -d www.huskyfurniture.com
Congratulations! we prepare a complete web configuration