The Apache HTTP Server, colloquially called Apache, is free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.
In this tutorial, i am going to show you how to install apache on ubuntu 20.04.
How To Install Apache On Ubuntu 20.04
Just use the below given steps to install apache on ubuntu 20.04:
- Step 1 – Install Apache On Ubuntu
- Step 2 – Check Apache Status
- Step 3 – Adjust Firewall
- Step 4 – Test Install Apache Web Server on Ubuntu
- Step 5 – Manage the Apache services
- Step 6 – Apache configuration file
Step 1 – Install Apache On Ubuntu
Open terminal and execute the following command on terminal to update the apt package:
sudo apt-get update
Then execute the following command on terminal to install Apache On Ubuntu:
sudo apt-get install apache2
Step 2 – Check Apache Status
Once the apache installation is done, Execute the following command on terminal to check the Apache service status:
sudo systemctl status apache2
Output
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
`-apache2-systemd.conf
Active: active (running) since Sun 2018-12-31 05:18:45 PDT; 2min 30s ago
Main PID: 3143 (apache2)
Tasks: 55 (limit: 2321)
CGroup: /system.slice/apache2.service
|-3143 /usr/sbin/apache2 -k start
|-3144 /usr/sbin/apache2 -k start
`-3145 /usr/sbin/apache2 -k start
Step 3 – Adjust Firewall
If a firewall is enabled on our system (like it should), to make the content accessible from outside our machine, you need to open HTTP (80
) and HTTPS (443
) ports by executing the following command on terminal:
sudo ufw allow 'Apache Full'
Verify the change with :
sudo ufw status
Output
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
Apache Full ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
Apache Full (v6) ALLOW Anywhere (v6)
Step 4 – Test Install Apache Web Server on Ubuntu
http://your_server_ip
The page includes some basic information about Apache configuration files.
Step 5 – Manage the Apache services
There are many services available in Apache, as follows:
Stop Apache service :
sudo systemctl stop apache2
Start Apache service :
sudo systemctl start apache2
Stop and then start the service again :
sudo systemctl restart apache2
Reload the Apache service after you made some configuration changes :
sudo systemctl reload apache2
To disable the Apache service :
sudo systemctl disable apache2
To re-enable the service to start up at boot :
sudo systemctl enable apache2
Check Apache Status :
sudo systemctl status apache2
Step 6 – Apache configuration file
On most systems if you install Apache on Ubuntu with a package manager, or it came preinstalled, the Apache configuration file is located in one of these locations:
/etc/apache2/httpd.conf
/etc/apache2/apache2.conf
/etc/httpd/httpd.conf
/etc/httpd/conf/httpd.conf
If you installed Apache from source it is likely located in /usr/local
or /opt
, though the config files may have been moved to /etc
as usual. Check your build script for more details
Conclusion
In this tutorial, You have successfully installed Apache on your Ubuntu 20.04 server.