How to create virtual hosts on Apache (httpd) on CentOs 7



Free Linux Cheat Sheet Download: http://eepurl.com/dkRNM9

Using virtual hosts on Apache allows you to host multiple websites on one server. In order for virtual hosts to function correctly you will need to insure that you have DNS set up correctly for your sites. If you are following this tutorial for test purposes you can reference this video on how to manually set DNS on a Centos Server:

If you need to know how to install apache on CentOs you can reference this video:

The commands that you need to follow this video can be found here:

How to create virtual hosts on Apache (httpd) on CentOs 7

Read More

8 Comments

  1. Hi, I've recently had this as a beginner task to a new job I've started. My task involves making the second site use port 4445. How can this be done? Every time I include "Listen 4445" in the httpd.conf file both sites stop working. If I change the site2.com.conf file then it just shows site1's content when going to site2.com for example. Not sure what I'm not seeing here.
    Thanks for the video btw Darren, found your channel when researching my issue earlier today, went to reddit to see what I could find there and found your post about making Centos videos, they're very informative from one Irish lad to another, its appreciated!

  2. All good, but, how can I access from other sistem? I'm doing this on VMWare, but I can't get access to the sites from the browser on other virtual machine.
    Great video.

  3. I am getting "ln: failed to create symbolic link ‘/etc/httpd//Sites_Enabled/site_Two.com.conf’: No such file or directory", Do I need to create the conf files before running this script?

  4. Darren thanks for the tutorial. I was able to follow the instructions to set up vhost, however I am unable to view site1.com and site2.com. When I put my local IP for the website server (192.168.0.1), it says "This is site1". Any tips on what to fix? This is the second time I am doing this again with a fresh CentOS7 box and I just can't get the padlock to come up.
    Thanks for the video

Comments are closed.