Prerequisites
Install Apache
The apache HTTP web server packages are inbuilt in Red Hat repository packages which we can easily install using “yum” command. The only thing is to know the Apache HTTP server’s service is known as “httpd” in RHEL Operating System.
To install HTTP package, first, need to update Red Hat package index and install httpd using the following command:
$ sudo yum update $ sudo yum install httpd
Now, the apache httpd web server is installed. You can enable and start httpd service using following command:
$ sudo systemctl enable httpd $ sudo systemctl start httpd
Configure the Firewall for Apache httpd server on RHEL 8
Nowadays, every system we protecting with Firewall to secure system and services. If Firewall also protests your RHEL system, you need to open HTTP (80) and HTTPS (443) port to access the webserver.
$ sudo firewall-cmd --permanent --zone=public --add-service=http $ sudo firewall-cmd --permanent --zone=public --add-service=https $ sudo firewall-cmd --reload
Verify Apache Installation
To verify apache httpd web server installed and everything working as per the instructions, you can check the status of httpd service status and version:
$ sudo systemctl status httpd
Output- ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2019-06-26 07:13:07 UTC; 11s ago Docs: man:httpd(8) man:apachectl(8) Main PID: 3059 (httpd) ...
$ sudo httpd -v
Output- Server version: Apache/2.4.6 (rhel) Server built: Oct 19 2017 20:39:16
Manage Apache Service:
We can manage apache service in the similar of another systemd services.
To stop httpd service use following command:
$ sudo systemctl stop httpd
To start again httpd service, run following command:
$ sudo systemctl start httpd
To restart apache httpd service, use the following command:
$ sudo systemctl restart httpd
To reload apache httpd web service after any changes, run following command:
$ sudo systemctl reload httpd
To disable apache httpd service to start on boot, use following command:
$ sudo systemctl disable httpd
To enable httpd service again, use below command:
sudo systemctl enable httpd
Apache Configuration File’s Structure
- /var/www/<site_Name>
- /var/www/html/<Site_Name>
- /opt/<site_Name>
- /home/<user_name>/<Site_Name>
Conclusion
You have learned to install Apache httpd web server on your RHEL 8 server or system. Now your system is ready to deploy a web application using Apache virtual host or use Apache as a web proxy server for your application.
0 Comments