FedoraRHEL Based

How To Install Apache on Fedora 40

Install Apache on Fedora 40

In this tutorial, we will show you how to install Apache on Fedora 40. The Apache HTTP Server is the world’s most widely-used web server software. It powers millions of websites and web applications across the internet. If you’re running a Fedora 40 server, installing Apache allows you to host websites, deploy web apps, and leverage Apache’s robust feature set.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Apache web server on a Fedora 40.


Before we dive into the installation process, ensure that you have the following prerequisites in place:

  • A server running one of the following operating systems: Fedora 40.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora provides the Terminal application for this purpose. It can be found in your Applications menu.
  • A stable internet connection to download the necessary packages.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Apache on Fedora 40

Step 1. Update the System.

Keeping your system packages up-to-date is crucial for security and stability. Use the DNF package manager to update all installed packages:

sudo dnf clean all
sudo dnf update

This fetches the latest versions of packages from the Fedora repositories and installs any available updates.

Step 2. Installing Apache HTTP Server on Fedora 40.

With your system updated, you can now install the Apache web server package:

sudo dnf install httpd

This command installs the httpd package, which is Fedora’s standard Apache package. During the installation, you might be prompted to approve the download and installation of dependencies, which are crucial for Apache to function correctly.

Even if Apache started automatically, it’s a good idea to verify its status and enable it to start on system boot:

sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd

The status command should show Apache running. If not, investigate any errors reported.

Step 3. Open Firewall for HTTP/HTTPS.

For remote clients to access your Apache web server, you need to open the HTTP (80) and HTTPS (443) ports on the firewall:

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload

Verify the new rules are in place:

sudo firewall-cmd --list-all

Step 5. Test Apache.

With Apache installed and the firewall configured, you can test if it’s serving content by accessing the default Apache page. Using your server’s IP address or hostname, enter this in a web browser:


You should see the Apache2 Test Page with the iconic “It works!” message. This confirms Apache is successfully installed and serving HTTP traffic.

Install Apache on Fedora 40

Step 6. Configure Apache.

While the default configuration is fine for testing, you’ll want to customize Apache for your production use case. This is done by modifying the main configuration file at /etc/httpd/conf/httpd.conf.

Some common configuration changes include:

  • Setting ServerAdmin and ServerName values
  • Changing Apache’s user/group
  • Configuring NameVirtualHost for name-based virtual hosts
  • Enabling additional modules (mod_ssl, php, etc.)

For example, to enable name-based virtual hosting, uncomment these lines:

#NameVirtualHost *:80

#Include conf.d/*.conf

After making changes, restart Apache for them to take effect:

sudo systemctl restart httpd

Congratulations! You have successfully installed Apache. Thanks for using this tutorial for installing the Apache web server on your Fedora 40 system. For additional or useful information, we recommend you check the official Apache website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button