How To Install and configure Apache Web Server on Ubuntu 22.04 LTS


In this post, We will install and configure Apache HTTP web server on ubuntu 22.04 LTS 


The Apache HTTP server is the most widely-used web HTTP server in the world. It affords many effective aspects along with dynamically loadable modules, sturdy media support, and good sized integration with different famous web server application.


Step 1: Update the Ubuntu repository 


By default ubuntu has apache remote repository but its good protice to update the ubuntu current repository, You need to use the following command in order to update the  default repository. 

sudo apt-get update 


Step 2: Install Apache2 Package  


Once the ubuntu repository updated we are good to install the apache package on ubuntu machine by executing following command 

sudo apt-get install apache2 -y 

  

Step 3: Check Service Status 


After installation of apache web server on ubuntu, We will get the apache service in running status, To verify it we need to execute the following command.


sudo systemctl status apache2.service

You should get output like this.


Step 4: Open UFW Firewall 


If you have your OS firewall service enabled then need to open port 80 with UFW firewall to get access on apache server from outside of the machine, You need to execute the following command for the same.


sudo ufw allow 80


Step 5: Get IP Address 


You required the public or local up address to test the webserver on the browser, Here you can execute the following command for the same.


To get local IP address execute the following command 

ifconfig

You should get output like this.

To get Public IP address execute the following command

You should get output like this.

curl ifconfig.co 


Step 6: Verify with Browser 


After getting the IP address of the web server, You need to check with browser with to test apache web server properly working on not.


Open you browser and open with the IP address like this.

For local environment 

http://localhost or http://MY_LOCAL_IP_ADDRESS_HERE

To get access from the public network, Use the public IP address here like this.


http://MY_PUBLIC_IP_ADDRESS_HERE

You should output like this.


Step 7: Controlling Apache Process


To control the Apache web server on ubuntu machine, You need to follow the given commands.

To check apache web server process in ubuntu machine.

sudo systemctl status apache2.servcie

To stop apache web server process in ubuntu machine.

sudo systemctl stop apache2.servcie

To start apache web server process in ubuntu machine.

sudo systemctl start apache2.service

To restart apache web server process in ubuntu machine.

sudo systemctl restart apache2.service

To reload apache web server process in ubuntu machine.

sudo systemctl reload apache2.service

To enable on boot apache web server process in ubuntu machine.

sudo systemctl enable apache2.service

To disable on boot apache web server process in ubuntu machine.

sudo systemctl disable apache2.servcie

Conclusion

Now we have Installed Apache HTTP server on ubuntu machine, Still you have any question, Please leave a message below.



How To Install and configure Apache Web Server on Ubuntu 22.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top