How to set up Apache Virtual Host on CentOS Stream 10

To set up and configure an Apache Virtual Host on CentOS Stream 10, follow the steps below.

Step 1 : Begin by updating your CentOS Stream 10 system to ensure you have the latest security patches and software updates.

Step 2 : If Apache is not already installed, install it using the following command:

Step 3 : Create a directory to hold your website files. For example, for the domain example.com:

Step 4 : Add an index.html file to the web directory as a placeholder for your website:

Step 4 : Set appropriate ownership and permissions for the web directory:

Step 5 : Create Virtual Host Configuration

Create a virtual host configuration file for your domain:

Add the following content:

Save and exit the file.

Step 6 : Test your Apache configuration for syntax errors:

If no errors are found, restart Apache to apply the changes:

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

Congratulations! You have successfully set up an Apache Virtual Host on CentOS Stream 10.