The Apache HTTP Server or simply Apache, is free and open-source cross-platform web server software developed and maintained by Apache Software Foundation. Apache is a easy to learn and configure web server providing an ability to host websites mainly via HTTP or HTTPS protocols. Under RHEL 8 / CentOS 8 system Apache webserver is know under name httpd
.
In this tutorial you will learn:
- How to install Apache webserver
- How to enable and start Apache webserver
- How to open firewall HTTP port 80
- How to create basic same website
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Red Hat Enterprise Linux 8 |
Software | Apache/2.4.35 (Red Hat Enterprise Linux) |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
How to install Apache on RHEL 8 / CentOS 8 Linux step by step instructions
- First step is to use
dnf
command to install package calledhttpd
:# dnf install httpd
- Run and enable the Apache webserver to start after reboot:
# systemctl enable httpd # systemctl start httpd
- Optionally, if you need your Apache web server to be accessed from remote locations open HTTP firewall port 80:
# firewall-cmd --zone=public --permanent --add-service=http # firewall-cmd --reload
For more information visit RHEL 8 open HTTP firewall port 80 and HTTPS port 443 with firewalld tutorial.
- Insert your website files.
By default the Apache web server will greet you with a default welcome page.To disable the default Apache welcome page insert your
index.html
into/var/www/html/
directory. For example:echo Apache on RHEL 8 / CentOS 8 > /var/www/html/index.html
- Access your website.
To access your new sample website navigate your web browser to either
http://YOUR-APACHE-IP-ADDRESS
orhttp://YOUR-APACHE-HOSTNAME
. For examplehttp://192.168.1.151
.