How to Install Apache on Debian 9
Table of Contents
Install Apache on Debian 9
Apache is the most popular and most used HTTP web server in the world. Apache is the opensource, cross-platform, powerful, stable, reliable and free web server providing features which can be extended by the wide variety of modules. It is also used as a reverse proxy server in different scenarios. In this tutorial, you are going to learn how to install Apache on Debian 9.
Before you start to install Apache on Debian 9. You must have the root user account credentials of your system.
Apache is already available in buntu default software repositories. So in this tutorial, we will install Apache by using
apt package manager.
First, update the
apt package manager index by typing the following command:
sudo apt update
In Debian based system Apache service is called
apache2. To install
apache2 package run below command.
sudo apt install apache2
After completion of the above command, Apache is installed on your system. Run the following command to check
apache service status.
sudo systemctl status apache2
The output should look like:
● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d `-apache2-systemd.conf Active: active (running) since Sun 2019-02-06 10:56:11 PDT; 2min 41s ago Main PID: 3143 (apache2) Tasks: 55 (limit: 2321) CGroup: /system.slice/apache2.service |-3143 /usr/sbin/apache2 -k start |-3144 /usr/sbin/apache2 -k start `-3145 /usr/sbin/apache2 -k start
Adjust the Firewall
Now to open HTTP and HTTPS ports for Apache run following command:
sudo ufw allow 'Apache Full'
To verify changes run following command:
sudo ufw status
The output should look like:
Status: active To Action From -- ------ ---- 22/tcp ALLOW Anywhere Apache Full ALLOW Anywhere 22/tcp (v6) ALLOW Anywhere (v6) Apache Full (v6) ALLOW Anywhere (v6)
As you can check in above output access to Apache is allowed.
Verify Apache Installation
Open your favorite browser and open below URL to verify
The output should be:
If you get above output screen which contains basic information about Apache configuration, then you have successfully verified Apache installation on Debian.
Manage Apache Process
Following are some basic commands to manage
Restart apache web server type following command:
sudo systemctl restart apache2
Stop web server type following command:
sudo systemctl stop apache2
To start web server type following command:
sudo systemctl start apache2
Reload configuration file typing following command:
sudo systemctl reload apache2
Apache service will start after boot to disable this run below command:
sudo systemctl disable apache2
To enable Apache service to start after boot run:
sudo systemctl enable apache2
Apache important default files
Following are the Apache important files and directories:
- Apache main configuration file is located at
- Apache main configuration files directory:
- Ports where apache can listen are defined in
- Virtual Host files stored at
/etc/apache2/sites-availableand to activate each file should be linked to
- Error log file located at
- Access log file located at
- Document root for web files
You have successfully learned how to install Apache on Debian 9. If you have any queries please don’t forget to comment out.
How to Install Ruby on Debian 9
How to install Pip on Debian 9
How to Install Go on CentOS 7
How to install phpMyAdmin on CentOS 7
How to Install Adobe Flash Player on Ubuntu
How to List Installed Packages on Linux Mint
How to Use SCP Command to Transfer Files/Folders in Linux
How to Install DataGrip on CentOS 7
How to Kill Process in Linux
How to Install PostgreSQL on Debian 9
How to Install Java on Linux Mint 19
How to Install Gradle on Linux Mint 19