×

Install Apache Web Server on CentOS 8 - Step by Step process to do it ?

This article covers how to install Apache web server on CentOS 8 distribution. With Apache we server, you can host web pages over the network. Apache is available within CentOS's default software repositories, which means you can install it with the dnf package manager.


To install Apache on CentOS:

1. Execute the command below to install the Apache package:

$ sudo dnf install httpd

After confirming the installation, dnf will install Apache and all required dependencies.

2. If you also plan to configure Apache to serve content over HTTPS, you will also want to open up port 443 by enabling the https service:

$ sudo firewall-cmd --permanent --add-service=https

3. Next, reload the firewall to put these new rules into effect:

$ sudo firewall-cmd --reload

After the firewall reloads, you are ready to start the service and check the web server.


To check your Apache Web Server:

1. Apache does not automatically start on CentOS once the installation completes, so you will need to start the Apache process manually:

$ sudo systemctl start httpd

2. Verify that the service is running with the following command:

$ sudo systemctl status httpd

You will receive an active status when the service is running.


To manage the Apache Process on CentOS:

Now that the service is installed and running, you can now use different systemctl commands to manage the service.

1. To stop your web server, type:

$ sudo systemctl stop httpd

2. To start the web server when it is stopped, type:

$ sudo systemctl start httpd

3. To stop and then start the service again, type:

$ sudo systemctl restart httpd

4. If you are simply making configuration changes, Apache can often reload without dropping connections. To do this, use this command:

$ sudo systemctl reload httpd

5. 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 httpd

6. To re-enable the service to start up at boot, type:

$ sudo systemctl enable httpd

Apache will now start automatically when the server boots again.


Steps to install Apache web server on Ubuntu 20.04 LTS ?

This article will guide you on steps to #install and configure #Apache on #Linux server.

Apache is one of the most popular web servers that allows you to run a secure website without too much of a headache.

#HTTPD is a program that is (essentially) a program known as Apache Web server. The only difference I can think of is that on Ubuntu/Debian the binary is called apache2 instead of httpd which is generally what it is referred to as on RedHat/CentOS. Functionally they are both 100% the same thing.

Apache server root will be located in /etc/httpd. The path to the apache #program will be /usr/sbin/httpd. In the document root three directories are created: cgi-bin, html and icons.

By default, Apache web server is instructed to listen for incoming connection and bind on port 80. If you opt for the TLS configuration, the server will listen for secure connections on port 443.

To start Apache server on Debian / Ubuntu Linux Specific Commands to Start/Stop/Restart Apache:

1. Restart Apache 2 web server, enter: # /etc/init.d/apache2 restart. $ sudo /etc/init.d/apache2 restart.

2. To stop Apache 2 web server, enter: # /etc/init.d/apache2 stop.

3. To start Apache 2 web server, enter: # /etc/init.d/apache2 start.