![]() |
|
How to Create Apache Virtual Hosts on CentOS 7 - Printable Version +- My Board (https://ellohost.com/forum) +-- Forum: Tutoriel EN (https://ellohost.com/forum/forumdisplay.php?fid=8) +--- Forum: Others (https://ellohost.com/forum/forumdisplay.php?fid=20) +--- Thread: How to Create Apache Virtual Hosts on CentOS 7 (/showthread.php?tid=142) |
How to Create Apache Virtual Hosts on CentOS 7 - aaron - 08-12-2023 How to Create Apache Virtual Hosts on CentOS 71. Installing ApacheBefore we begin, make sure that you have root access to your VPS or server using SSH connection. Install Apache on your CentOS 7 machine by typing the following command:
Once the installation is completed, enable Apache as a CentOS service:
Visit your server’s IP address to check whether Apache is already running or not. The page should look like ![]() 2. Creating a Directory TreeA directory tree is used to hold website data. First, set the working directory to /var/www by running this
You should use a unique document root for each virtual host:
Remember to replace Make the directory accessible to Apache. Run the
Apache now has the required access to create additional directories and serve content for incoming queries. 3. Creating a Demo PageIt is recommended to make a demo page for your Apache virtual hosts. This way, you can check whether the host Use the
Paste the following content to the file:
Save the file by pressing CTRL + X and then Y. 4. Creating the Virtual HostCreate a new virtual host
Insert the following content into the
In the example above, we tell Apache that we will be using port 80 for the communication and that Restart Apache for the changes to take effect:
That’s it, you have just created an Apache virtual host for your domain! Now try to access the host and you |