How to install Apache on Ubuntu 20.04 LTS

Installing Apache web server on Ubuntu 20.04 LTS is a simple process and can be done by following these steps:

  1. First, update the package list by running the command:
sudo apt update
  1. Next, install Apache by running the command:
sudo apt install apache2
  1. After the installation is complete, Apache should automatically start and start listening on port 80. You can check the status of the Apache service by running the command:
sudo systemctl status apache2
  1. To make sure that Apache starts automatically at boot time, you can run the command:
sudo systemctl enable apache2
  1. By default, Apache serves files from the directory /var/www/html. You can test that Apache is working by opening a web browser and navigating to http://localhost or http://your-server-ip. You should see the Apache default welcome page.
  2. If you want to allow external access to your server, you need to configure the firewall to allow incoming traffic on port 80. You can do this by running the command:
sudo ufw allow in "Apache Full"
  1. You can also configure Apache to serve virtual hosts, which allows you to host multiple websites on a single server. To create a virtual host, you can create a new configuration file in the directory /etc/apache2/sites-available, and then enable it by running the command:
sudo a2ensite example.com.conf
  1. Finally, you need to reload Apache to apply the changes by running the command:
sudo systemctl reload apache2

Apache is now installed and configured on your Ubuntu 20.04 LTS system. You can customize your Apache configuration by editing the files in the /etc/apache2 directory. (https://yurtsofamerica.com/)

Leave a Comment