Apache 2 Server Installation in Ubuntu Server v.22.04.2
1. Ensure Ubuntu repository is up-to-date.
sudo
apt update && sudo apt upgrade -y |
sudo
apt install apache2 -y |
sudo
ufw app list |
sudo
ufw status |
sudo
ufw allow ‘Apache’ |
sudo
mkdir /var/www/[Domain Name] |
sudo
chown -R $USER:$USER /var/www/[Domain Name] |
sudo
chmod -R 755 /var/www/[Domain Name] |
sudo
nano /var/www/[Domain Name]/index.html |
<html> <head> <title>WELCOME TO [DOMAIN NAME] !</title> </head> <body> <h1>SUCCESS ! THE [DOMAIN NAME] VIRTUAL HOST IS WORKING !</h1> </body> </html> |
sudo
nano /etc/apache2/sites-available/[Domain
Name].conf |
<VirtualHost
*:80> ServerAdmin webmaster@localhost ServerName [Domain Name] ServerAlias www. [Domain Name] DocumentRoot /var/www/[Domain Name] ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log
combined </VirtualHost> |
9. Enable the newly created site.
sudo
a2ensite [Domain Name].conf |
sudo
a2dissite 000-default.conf |
sudo
apache2ctl configtest |
sudo
systemctl restart apache2 |
Edit: Added video for easy references.
!!! HAPPY COMPUTING !!!
No comments:
Post a Comment