Open In App

How to make sure that Apache service keeps running in Ubuntu

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

Majority of world’s websites are hosted on are hosted on Apache Web Servers and the majority of those servers run Apache in Linux. Let’s see how to install Apache in Ubuntu:

Type the following commands in terminal application on your computer:

$ sudo apt-get update
$ sudo apt-get install apache2

Now type localhost on your browser. It will pop up a message “IT WORKS“.

There is also another way to check whether Apache Services running in the browser or not. To check, first find the IP Address using the below command:

$ifconfig

Now, put that IP address on the browser. The same message is being displayed “IT WORKS”. This ensures that Apache service keeps running in Ubuntu.

To find out the active ports then type:

$ netstat -a|more

Here we get all of the ports, our active connections, our virtual ports essentially that our computer is listening. If you need to get the port numbers then type:

$ netstat -an|more

It shows port80, the port for the web server, port for HTTP, it listens to every address available. Our web server is listening.

Characteristics:

  • To stop the web server then type:
    $ sudo /etc/init.d/apache2 stop

    To check it Type:

    $ netstat -an|more

    Now our web server is no more listening.

  • To start our web server, type:
    $ sudo /etc/init.d/apache2 start

  • To Restart our web server, type:
    $ sudo /etc/init.d/apache2 restart

    To check, Type:

    $ netstat -an|more

    Now our server is running.

Now We have to create and edit our Webpage. So type the following command:

$ cd /var/www

Press ENTER to continue.

:/var/www$ ls

Press ENTER to continue.

index.html

This ‘index.html‘ is the default Webpage in the Apache. To edit the Webpage, type the Command:

:/var/www$ sudo nano index.html




<html>
<head><title>
Dans Homepage</title>
</head>
<body><h1>Welcome to my webpage!</h1>
<p>This website is under construction.</p>
</body>
</html>


Press CTRL+X to save and exit.

Type localhost or Your IP address on the address bar of a web browser. ‘index.html‘ page will be displayed.


Last Updated : 03 Jan, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads