This article covers how to install an Apache web server on your Debian 9 server. The Apache HTTP server is the most widely-used web server in the world. It provides many powerful features including dynamically loadable modules, robust media support, and extensive integration with other popular software.
How to Install Apache ?
1. Let's begin by updating the local package index to reflect the latest upstream changes:
$ sudo apt update
2. Then, install the apache2 package:
$ sudo apt install apache2
After confirming the installation, apt will install Apache and all required dependencies.
The Apache profiles begin with WWW:
1. WWW: This profile opens only port 80 (normal, unencrypted web traffic).
2. WWW Cache: This profile opens only port 8080 (sometimes used for caching and web proxies).
3. WWW Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic).
4. WWW Secure: This profile opens only port 443 (TLS/SSL encrypted traffic).
How to Manage Apache Process ?
To stop your web server, type:
$ sudo systemctl stop apache2
To start the web server when it is stopped, type:
$ sudo systemctl start apache2
To stop and then start the service again, type:
$ sudo systemctl restart apache2
If you are simply making configuration changes, Apache can often reload without dropping connections. To do this, use this command:
$ sudo systemctl reload apache2
By default, Apache is configured to start automatically when the server boots. If this is not what you want, disable this behavior by typing:
$ sudo systemctl disable apache2
To re-enable the service to start up at boot, type:
$ sudo systemctl enable apache2
Apache should now start automatically when the server boots again.