Setup Apache virtual hosts in RHEL 9 to manage multiple domains with ease. Our Apache Support team is ready to assist you.
Setup Apache Virtual Hosts in RHEL 9
Apache HTTP Server, widely known as Apache, is one of the most popular web servers in the world. It powers millions of websites and continues to hold a strong presence because of its flexibility, reliability, and ease of use. Originally developed by the Apache Software Foundation, this open-source platform allows administrators and developers to deliver content across the web securely and efficiently.
In this article, we will explore the key features that make Apache so popular, explain how to install and configure it on RHEL 9, discuss virtual host configuration, share optimization practices, and provide a brief comparison between Apache and Nginx to help you make an informed choice.
Core Features That Make Apache a Leading Web Server
Apache remains a go-to solution for hosting because of its wide range of capabilities:
Open Source and Free: Apache is completely free to use, modify, and distribute. Its open-source nature ensures ongoing community contributions and global support.
Cross-Platform Compatibility: It runs smoothly on Linux, Windows, macOS, and other platforms, giving users flexibility in deployment.
Modular Architecture: With a vast library of modules, Apache can be extended to handle caching, security, authentication, and URL rewriting without modifying the core code.
Flexible Configuration: Administrators can control server behavior at both global and directory levels, making fine-tuning easy through configuration files.
Dynamic Content Handling: Apache works smoothly with PHP, Python, and Perl for dynamic websites. To process server-side includes, Activate SSI Apache, allowing reusable HTML components like headers and footers for easier site management.
Virtual Hosting: A single server can host multiple domains, making it ideal for businesses and developers managing several sites.
Security and Reliability: With SSL/TLS support, authentication options, and robust stability, Apache offers strong protection and consistent performance for websites of all sizes.
Installing and Configuring Apache on RHEL 9
Getting Apache up and running on RHEL 9 is a straightforward process. Follow these steps to set up your server.
Step 1: Install Apache
Use the DNF package manager to install the Apache HTTP server:
sudo dnf install httpd -y
sudo dnf install mod_ssl -yStep 2: Enable and Start Apache
Enable Apache to start at boot and launch the service:
sudo systemctl enable httpd
sudo systemctl start httpd
sudo systemctl status httpdStep 3: Configure the Firewall
Allow web traffic through the firewall:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reloadStep 4: Verify the Installation
Open a web browser and navigate to your server’s IP address. The Apache test page confirms a successful installation.
Managing Multiple Sites with Apache Virtual Hosts
One of Apache’s strongest features is its ability to manage multiple domains on a single server through virtual hosts.
- Create directories for each website in /var/www/.
- Set the correct permissions for each directory.
- Add a simple index.html file to confirm the site is working.
- Create configuration files for each domain in /etc/httpd/conf.d/.
- Edit each configuration to include the server name, document root, and log file locations.
- Restart Apache to activate the virtual hosts.
This setup allows you to run multiple websites efficiently, each with its own domain name and content.

Optimizing Apache for Security and Performance
To keep your server safe and efficient, you should apply the following practices:
Security Enhancements
- Keep Apache updated to patch vulnerabilities.
- Hide version details with ServerTokens Prod and ServerSignature Off.
- Disable unused modules to reduce attack surfaces.
- Run Apache with a non-privileged user for safety.
- Use HTTPS with strong SSL/TLS encryption.
- Install Web Application Firewalls like mod_security.
Sometimes, misconfigurations in SSL or virtual hosts can trigger errors. Knowing how to fix AH01630 Apache error ensures uninterrupted service and prevents downtime caused by certificate or directory mismatches.
Performance Improvements
- Choose the right Multi-Processing Module (event MPM is usually best for high traffic).
- Enable KeepAlive with optimized timeout values.
- Use caching and Gzip compression to reduce load times.
- Tune worker settings to match available resources.
- Disable .htaccess overrides and manages configurations centrally.
- Use a load balancer for scaling large websites.
Apache vs Nginx: Which One Should You Choose?
Both Apache and Nginx are industry-leading web servers, but they serve different use cases.
- Apache excels in flexibility, dynamic content handling, and compatibility with .htaccess-based shared hosting environments.
- Nginx is better for high-traffic sites, static content delivery, and load balancing due to its event-driven architecture.
For websites with complex configurations and dynamic applications, Apache remains a reliable choice. For scalability and modern API-driven platforms, Nginx often performs better.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
Apache stands out for its flexibility, security, and reliability in web hosting. When you set up Apache virtual hosts in RHEL 9, you can efficiently manage multiple domains on one server, making it a smart choice for scalable and secure website management.
In brief, our Support Experts demonstrated how to fix the “554 5.7.1 : Relay access denied” error.
