How to set up Apache Virtual Host on CentOS 7

To set up Apache Virtual Host on CentOS 7, follow the steps below.

Step 1 : Ensure your system is up to date by running:

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

Step 3 : Create a directory to store your website files:

Step 4 : Create a simple index.html file for testing purposes:

Step 5 : Set appropriate permissions for the web directory:

Step 6 : Create a new virtual host configuration file for your domain:

Add the following content to the configuration file:

Step 7 : Check the configuration for syntax errors and restart Apache:

Step 8 : Now, visit your domain (example.com) in a web browser to test your website.

Congratulations! You have successfully set up Apache Virtual Host on CentOS 7.