Step 1: Install Apache using YUM

sudo yum install httpd -y

Step 2: Configure Apache

Remove the default Apache welcome page:

sudo cp /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf

Prevent Apache from exposing files in visitors’ web browser:

sudo cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf

Start the Apache service and set it to auto-start on system boot:

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

The above settings are only basic settings for running an Apache web server. More specific settings can be found in the Apache configuration file /etc/httpd/conf/httpd.conf. You can use the vi text editor to review and edit various settings in that file:

sudo vi /etc/httpd/conf/httpd.conf

After the editing is done, you should restart the Apache service in order to apply your modifications:

sudo systemctl restart httpd.service

That’s it. Thanks for reading.