How to Install and Setup Apache Web Server on Ubuntu 22.10


Author - Sanjay


In this post we will follow step by step guide to install Apache Web Server in Ubuntu 22.10 .

The Apache Web Server is open source and the most popular way to serve data on the internet. The Apache Web Server is available on Ubuntu 20.10 and can be easily installed using the apt package manager.

Once the Apache Web Server is installed, it can be configured to serve web content from any directory and anywhere on the system.

The Apache Web Server can be used to reverse proxy requests to single or multiple servers. This can be useful for load balancing or for accessing servers that are behind a firewall. One of the amazing features of Apache is ProxyPass and ProxyPassReverse directives which an be used to configure the Apache Web Server to act as a reverse proxy.

The Apache Web Server can be used as a load balancer by using the ModProxyBalancer as well.

Table of Contents


A Ubuntu 22.10 server or a Desktop with root privilages. You can also get a Free VPS hosting like Vultr or DigitalOcean.

Installing Apache

  1. Let's update our repo as usual by executing follwoing command
thelinuxt$ sudo apt-get update 

Update Repository

Installing Apache2

We do not need to configure repository for installing apache2 . Execute the following command

sudo apt-get install apache2

Install apache2

Once installed, verify the installation of the Apache server is sucessful or not . We can do this by checking apache service is running or not . Execute the below command to check the running status of apache .

thelinuxt$ sudo systemctl status apache2

Status Apache

We havent enabled any systemd , but apache itself enables systemd and enables apache2 service for us and we can get the apache2 status using above command .

Open Ports In Apache Using Firewall Configurations

No we need to have a firewall configuration to enable certain ports on our Apache server .In order to open PORT 80 in your Apache server to access outside your host system , we need to enable firewall configuration. In order to do that we need to list out the application profiles that are basically listed as a part of firewall in your Ubuntu system execute the following command to check.

linuxterminal@linuxterminal:~$ sudo ufw app list

Status Apache

if we look above there are basically different types of Apache profiles that are attached to Apache which we need to enable access in order to access the apache application outside of my internal OS network or host nwetwork.

Also Read
  1. Install NVM on Centos8
  2. Instal JDK on Rocky Linux 8
  3. Install and Configure Nginx On Rocky Linux 8
  4. Shell Script to Parse CSV Files Linux
  5. How to Install MySQL on Ubuntu 22.10

Check Apache Web Server is Accessible By IP

As of now we will give access to Apache which will open port 80 outside host network.

But if you see think we also have Apache full as well as Apache secure as a part of app list output. Apache secure is basically meant for providing http based access and open port 8443. If we want to enable port 80 and 8443 we can enable "Apache Full" .

linuxterminal@linuxterminal:~$ sudo ufw allow 'Apache Full

Have a look at the output for checking the status of firewall with Apache .

linuxterminal@linuxterminal-QEMU-Virtual-Machine:~$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Apache Full                ALLOW       Anywhere                  
Apache Full (v6)           ALLOW       Anywhere (v6)             

lets verify if apache is still running or not .

linuxterminal@linuxterminal:~$ sudo systemctl status apache2

Output :- Status Apache

Now it's clear from the output above that my Apache server is still running once I have configured the the firewall configuration .

Now lets verifiy Apache page is opened or not once you have enable the firewall for Apache. Now , you should be able to access the Apache home page from a IP and as well as using localhost shown below . Above settings is helpful if you are running your Apache on any of the the hosted service or any e VPS hosting provided by Digital ocean Godaddy hostinger Amazon ec2

lets go ahead and access the Apache web server using our IP , you can acess the web server using your IP as below .


Status Apache

Useful Commands to Manage Apache Web Server From Terminal

We will list down few of the important commands that we can use to manager for Apache process while we are playing with patcher in any of the Linux servers

Here are the list of few systemctl commands that we can use

In Order to restart apache server we can use

$ sudo systemctl restart apache2

In Order to Stop apache service we can use

$ sudo systemctl stop apache2

In Order to Start apache service we can use .

linuxterminal@linuxterminal:~$ sudo systemctl start apache2

Now let's say you have done some changes in your Apache configuration and you want to reload the configuration without restarting your server then you can execute the below command

linuxterminal@linuxterminal:~$ sudo systemctl reload apache2

Sometimes we disable the Apache configuration and we make sure the package does it start up as a service starts so if you face this kind of scenarios then you can try using the below command which will make sure the Apache is running once your server boots up.

linuxterminal@linuxterminal:~$ sudo systemctl enable apache2

Similarly we can disable the Apache you so that it doesn't start of the system boots up

linuxterminal@linuxterminal:~$ sudo systemctl disable apache2

Managing Apache Logs In Ubuntu

Logs are one of the most important aspect of any application or software running on any kind of system. so if you are using Apache in Ubuntu then you might need to find out the server logs and debug any issues related to Apache so if you are facing any trouble such as your Apache service is not starting or Apache is hanged up then you can go ahead and verify the logs mentioned below.

Apache logs are generally present in /var/logs/apache2

linuxterminal@linuxterminal:~$ ls /var/log/apache2/
access.log    error.log    error.log.2.gz
access.log.1  error.log.1  other_vhosts_access.log
  1. Access Logs (/var/logs/apache2/access.log) are useful if we want to check who is accessing the server and what is the IP address
  2. Error Logs (/var/logs/error.log) useful if your apache2 is not running or we have received any errors .


Apache is one of the most popular web server used nowadays and we have seen how we can configure the basic Apache server in any of the Linux systems we have primarily used Ubuntu but this configuration and the steps mentioned above will be useful and valid for any of the Linux service you are using .