First, we need to install Apache2, Before that Update Ubuntu with below command.
sudo apt-get update
Install Apache
sudo apt-get install apache2
Now activate mod_rewrite using below command
sudo apt-get update
Install Apache
sudo apt-get install apache2
Now activate mod_rewrite using below command
sudo apt-get update
sudo apt-get install apache2
sudo systemctl start apache2
OR
sudo service apache2 start