How to set up Apache Virtual Host on Rocky Linux 9

To install and configure Apache Virtual Host on Rocky Linux 9 for hosting multiple websites, follow the detailed steps below.

Step 1 : Update your system to ensure you have the latest packages.

Step 2 : Install the Apache web server using the package manager.

Step 3 : Create a directory to store the web files for your virtual host.

Step 4 : Use a text editor to create the main HTML file for your website.

Inside the editor, add the following HTML content:

Save and exit.

Step 5 : Set Permissions:

Step 6 : Create a configuration file for your virtual host.

Inside the editor, add the following configuration. Replace "example.com" with your desired domain or subdomain.

Save and exit.

Step 7 : Check the Apache configuration for syntax errors.

If there are no errors, restart Apache.

Step 8 : Open a web browser and navigate to your domain (e.g., http://example.com) to test your web server.

Congratulations! You have successfully set up and configured Apache Virtual Host on Rocky Linux 9.