Install and configure Apache server on Ubuntu?

Quick recipe to install and configure apache server?
Step1:- Update the package manager and install apache2
Execute the below commands in terminal:- 

  • sudo apt-get update
  • sudo apt-get install apache2

sudo – super user
apt-get, for latest package

Step2:- Edit the apache configuration file

  • sudo nano /etc/apache2.conf

edit apache config file

Scroll to the end and add,  ServerName localhost
ctrl +x (for exiting the editor) , press y and enter

Step3:-Check that server is running or not

  • sudo apachectl stop

Step4:- Start the apache server

  • sudo apachectl start

Step5:- Open browser with localhost, and see our server is running and launch a index.html file(note, we have changed our port to 403)

index page on launching apache server

Note:- This index.html file which apache server showed above can be located in /etc/apache2/var/www/html

Errors:- Incase default port 80 is already used you will get the below error on starting apache server?
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80

Solution:- Change the port value inside /etc/apache2/apache2.conf say to different port 403, now restart the apache server and open localhost:403, it will launch the server

Keep Learning and Keep Sharing 🙂

Install MySql
Install PHP 

Leave a Reply

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