Izhffrlw 5 WM 3 Mrbupb 7 Z

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

PROPOSED TO:

SIR UMER
SUBITTED BY
MUNIR HUSSAIN
TASK 26:
Apache Server on Linux
HELP:
As a Web server, Apache is
responsible for accepting directory (HTTP)
requests from Internet users and sending them
their desired information in the form of files
and Web pages. Apache is the most commonly
used Web server on Linux systems. Web
servers are used to serve Web pages requested
by client computers. Clients typically request
and view Web pages using Web browser
applications such as Firefox, Opera,
Chromium, or Internet Explorer.
How to install Apache web server on Linux
Apache is the most popular web server developed by Apache Software Foundation.
It offers several features that make it very useful for websites. Apache HTTP
server is supported on all operating systems including Linux, Windows, MacOS,
FreeBSD, etc. It is also a part of the web service stack-LAMP stack.

In this post, we will explain how to install Apache on Linux server. The commands
discussed in this article have been tested on Ubuntu 20.04 LTS (Focal Fossa).
The same commands are also valid for Debian distribution.

Prerequisites
• Ubuntu or Debian machine
• User with sudo privileges
AD

Apache Installation
Apache is available in the official repositories of Linux Ubuntu. Therefore, we can
easily install it using the apt-get install command. Following are the steps to install
Apache on Linux.

Step 1: Update System Repositories

First, update the system repositories using the following command in Terminal:
$ sudo apt-get update

AD

Enter sudo password.


AD

Step 2: Install Apache


Now in order to install Apache, issue the following command in Terminal:
$ sudo apt-get install apache2

AD

When prompted for confirmation, hit y, after which the installation of Apache will
be started on your system. Depending on your network connection, the installation
of Apache may take some time.

Step 3: Verify Installation


Once the installation of Apache is completed, you can verify it using the following
command in Terminal:
$ apache2 -v

The following output confirms the Apache has been installed with version 2.4.41.
You can also view the status of Apache service to verify if it is properly running.
Issue the following command in Terminal to do so:
$ systemctl status apache2

AD

The active (running) status in the following output shows that the Apache service
is active and running.

In case, the service is not started automatically, you can start it using the below
command:

$ sudo systemctl start apache2

Access Apache Default Webpage


You can also confirm if the Apache service is successfully running by accessing
the Apache default webpage. To do so, type your system’s hostname or IP address
in the location bar of any browser.
http://<host_name or ip_address>

AD

The following page shows that Apache has been successfully installed on your
system.
If you want to access the Apache from another system on the network, you will
need to configure a rule in the firewall which has been discussed in our post about
Apache configuration.

Remove Apache
In case, you no longer need Apache server on your system, you can easily remove
it using the below command:
AD
$ sudo apt-get remove apache2

When prompted for confirmation, hit y, after which the system will remove
Apache.

That is all there is to it! In this tutorial, you have learned how to install Apache on
Linux server. It takes just a few simple steps to install Apache web server in Linux
machine. In our next article, we will look at configuration for the Apache server
and host a small application.

https://linuxways.net/ubuntu/how-to-install-apache-web-server-on-linux/

Sure! Here are some common commands for managing the


Apache web server on Linux:

1. Start Apache:
```
sudo systemctl start apache2
```
or
```
sudo service apache2 start
```

2. Stop Apache:
```
sudo systemctl stop apache2
```
or
```
sudo service apache2 stop
```

3. Restart Apache:
```
sudo systemctl restart apache2
```
or
```
sudo service apache2 restart
```

4. Check the status of Apache:


```
sudo systemctl status apache2
```
or
```
sudo service apache2 status
```

5. Enable Apache to start on system boot:


```
sudo systemctl enable apache2
```
or
```
sudo update-rc.d apache2 enable
```

6. Disable Apache from starting on system boot:


```
sudo systemctl disable apache2
```
or
```
sudo update-rc.d apache2 disable
```

7. Test the Apache configuration for syntax errors:


```
sudo apache2ctl configtest
```

8. Reload Apache configuration without restarting:


```
sudo systemctl reload apache2
```
or
```
sudo service apache2 reload
```
9. Show the Apache version and compiled-in modules:
```
apache2 -v
```

10. View Apache access logs:


```
sudo tail -f /var/log/apache2/access.log
```

11. View Apache error logs:


```
sudo tail -f /var/log/apache2/error.log
```

These commands are commonly used on Ubuntu and


Debian-based distributions. However, the exact commands
may vary depending on your Linux distribution.

Index file:
/var/www/html
Check :
http://localhost/ or 127.0.0.1

Out put:

You might also like