# How to configure Apache server on Ubuntu 20.04

First of all Make sure your system is up to date,
To do that, type the following command


```
sudo apt update && sudo apt upgrade

``` 

### Step 1 - Install Apache 2 server
To install apache server run the following command



```
sudo apt install apache2
``` 

### Step 2 - Make sure Apache service starts on system boot
To check that run the following command


```
sudo systemctl is-enabled apache2.service
``` 
If you get Output similar to the image below then you are good to go


![Screen Capture_select-area_20210909082401.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1631156088262/tvexgAIGR.png)

*If your Output is not similar to the Image then run the following command to enable Apache service on boot*

```
sudo systemctl enable apache2.service
``` 
### Step 4 - Make sure your Apache server status is active
To check the status run the following command

```
sudo systemctl status apache2.service
``` 

![Screen Capture_select-area_20210909075109.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1631157430334/fO1WA0u6a.png)
If server status is active (running) then everything is fine, up and running

### Step 4 - Open Apache port 80 and 443

To open port 80 and 443 use the following commands


```
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
``` 
*if you are Configuring a cloud server then make sure to allow ssh so that you don't get locked out of your server.
Run the following command to allow SSH*


```
sudo ufw allow openssh
``` 
**Now Enable the firewall**


```
sudo ufw enable
``` 
Check Status of firewall


```
sudo ufw status
``` 
It should look like this

![Screen Capture_select-area_20210909084009.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1631157019457/uYJJNeHgN.png)

### Step 5 - Test your Apache server

Test Using terminal
```
curl -I http://<your-server-ip-address>/
``` 

![Screen Capture_select-area_20210909084501.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1631157312431/ULR87npTM.png)

To Test Using Web-Browser, Simply type your servers ip address in the address bar,and you should get output like this


![Screen Capture_select-area_20210909080617.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1631157386461/hNpOk25Ou.png)




