Apache Webserver Install on Linux
|
This document describe the process of installing |
-
Install
ApacheandApacherelated tools:sudo dnf install httpd httpd-tools -
Check the version of
Apache:httpd -v -
Start
Apache:sudo systemctl start httpd -
Enable
Apacheto start at boot:sudo systemctl enable httpd -
Allow
Apacheto Make Outgoing Network Connections:By default, SELinux forbids Apache to make outgoing network connections.
If Apache needs to make requests to an outside network service, then run the following command to allow this action.
setsebool -P httpd_can_network_connect on -
Check
Apachestatus and confirm that it’s listening on port 80:sudo systemctl status httpd -
Set the apache user as the owner of the web directory:
sudo chown apache:apache /var/www/html -R -
Configure firewall to allow traffic to ports: 80 and 443:
sudo firewall-cmd --permanent --zone=public --add-service=http (1) sudo firewall-cmd --permanent --zone=public --add-service=https (2) sudo systemctl reload firewalld (3)1 Open port 80 2 Open port 443 3 Restart the FW daemon -
Confirm
Apacheaccessibility:-
First create a test page:
sudu vi /var/www/html/index.html -
Enter the following html into that file:
<h1 align="middle">Welcome - this is a test page!</h1> -
Launch your browser and browse to the Linux server’s DNS name:

-
You should see the test page:

-
-
Apache is now installed.