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

preview_player
Показать описание

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:

Рекомендации по теме
Комментарии
Автор

Darren, I edited /etc/hosts and was able to see site1 & site2. Awesome, thank you again. Keep the videos coming.

ATHLETRO
Автор

Hi Darren, this is a great on how to quickly setup webservers on Centos 7. This is exactly what I was looking for, to get multiple webservers up and running to test load balancing.
Can you please make a video on how to setup DNS on Centos 7 using Bind

gullitlevia
Автор

Hi Darren, was searching for your SELInux tutorial that you mentioned on this clip that you will create. Have you created it yet. Thanks in advance

petermuia
Автор

Hi, Great video. We changed the permission of the folder sites only for apache, I can't create a html file after that.

Linuxenthusiast
Автор

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.

JaimicoCL
Автор

It's not working... Setenforce 0 not repair problem with job.. In httpd.conf j change sites-enabled to sites-available and serwer started however site1.com like site2.com not working : (

szybkijohny
Автор

Thanks for the starightforward and clear tutorial but please it would be more helpful if you explained why you did certain things. I hope you can clarify the following things which I'm confused about
1. You didn't explain why you created the available and enable files and why are they necessary
2. In other tutorials the virtual host configuration files were created under /etc/httpd/conf.d instead, does it make a difference and what advantage does your method under /etc/httpd/site-avaialble have
3. Your virtual host config file also contained error log files but I didn't see you create the log files and they aren't under /var/logs when I checked. Do we need to create these error.log files
4. You didn't add your virtual hosts to the /etc/hosts file
5. Why are the symbolic links necessary? Thanks. I'm sorry for the many questions but I'm learning and like to understand what I'm doing and why instead of just following a bunch of instructions. I've subbed.

Pyxelles
Автор

I am getting "ln: failed to create symbolic link No such file or directory", Do I need to create the conf files before running this script?

Pault
Автор

Can we use ssl parameters in< virtualhost>? Here

itman
Автор

unfortunately display the centos default page.I have change dns on my system32/hosts restart apache and still the same.what am i doing wrong?

xtc
Автор

Thanks - so what is vhosts folder for? You didn't use www/vhosts. Bit lost.

guitars-tm
Автор

Hi Darren, I followed both your tutorials on hosts and virtual hosts.. but I am still having issues. If I type my server's ip address it gets me automatically to site 1... but if I type the www.site1.com or www.site2.com, i get the error that the site can't be reached... I have setup my hosts file to point to my server's ip address with the 2 names.. what am I doing wrong?

Marc.

Marc-hycf
Автор

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!

grim
Автор

Hey Darren, Thanks for the tutorial. After completing the first step, I tried verifying if Apache can access the sites and I get chown: invalid user: ‘apache:apache’ error. Can you point me in the right direction to have this corrected? Thanks in advance.

rayvalle
Автор

Hi there,

If you like this video feel free to subscribe to my channel my clicking here:


More CentOS videos can be found on my CentOS playlist here:


Thanks :)

DarrensTechTutorials
Автор

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

ATHLETRO
Автор

There are unneeded extra steps with creating soft links in another directory. For me it worked without those.

mironovsan
Автор

Amazing. Thanks for share your knowledge!

franciscosantucci