Apache is a free and open-source cross-platform web server software. It is one of the most popular HTTP servers. Generally, it is used in combination with MySQL, PHP, and other scripting languages and forms a robust platform for the deployment of web applications.
I already discussed how to install the Apache web server using the LAMP stack on Ubuntu and other debian-based Linux distributions.
Today in this article we will discuss how to install and configure the Apache web server on Fedora Linux.
Prerequisites
To follow this guide you should have the following –
- A system running Fedora Linux
- Access to a user account that has superuser permissions
How to install Apache on Fedora
Before you install a package on your system first run the following command to update the local package database of your Fedora system –
sudo dnf update
Now use the following command to install the Apache web server on Fedora Linux –
sudo dnf install httpd
Press y and then enter if it asks for your confirmation.
You can verify the installation by using –
httpd -v
This will display the currently installed version of the Apache web server.
Start and enable Apache web server
Use the following command to start the apache services on your system –
sudo systemctl start httpd
and then enable it so that it gets automatically started on the next boot of your system.
sudo systemctl enable httpd
Check the status of the Apache web server
Run the given command to check the status of the Apache web server on your Fedora system –
sudo systemctl status httpd
Adjust firewall settings
You need to configure your firewall so that it allow HTTP an https traffic. Run the given command to modify firewall settings-
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --zone=public --add-service=https --permanent
Now reload firewall to make changes effective –
firewall-cmd --reload
Testing Apache web server on Fedora
You have installed and configured Apache Web server on your system. Now it time to test whether it is working or not.
Open a browser on your system and enter the given URL –
http://server_ip_or_domain_name
For example –
http://127.0.0.1
If webserver is working correctly you will see –
Apache webserver important files and directories on Fedora
The default server root directory: /etc/httpd
The default server root document directory which stores web files: /var/www/html
The main Apache configuration file: /etc/httpd/conf/httpd.conf
You can add additional configurations in: /etc/httpd/conf.d/
The configurations for modules: /etc/httpd/conf.modules.d/
Virtual hosts can be configured in file: /etc/httpd/conf.d/vhost.conf
Conclusion
You have successfully installed and configured Apache webserver on Fedora Linux. Now if you have a query then write us in the comments below.