-1

I have 5 real domain names and I have 5 different set virtual hosts I want to know how to connect the domain names to my virtual host I'm new to this so plz answer easy understandable answers Thanks for reading and hopefully answering

Tryhard
  • 5
  • 5
  • In DNS you have to point each domain name to the IP address of the server where you set up a virtual host. – cakan Apr 08 '15 at 09:49
  • Not really sure what you are asking. If you want to be able to access your local version by typing the domain name into the browser, then you need to configure your system to resolve that domain name to your local server IP. The easiest way to achieve that is to add an entry in your local `hosts` file. – CBroe Apr 08 '15 at 09:49
  • What I am trying to do is for example in my www file to have a folder that is called website 1 inside website1 is the website and al the files needed then I want to just connect that file website 1 to areal domain name so when some types what ever the website domain name is .com it will go to web site 1 that is located in my www/website 1 directory I want to this multiple web sites so some thing like this 1. Www/website1=> a real domain .com 2.www/website 2 => a real other domain .com and so on ect and @CBroe I think what your saying only applies on your local computer. – Tryhard Apr 08 '15 at 10:09
  • Still unclear what your actual problem is … is it about setting up the VirtualHosts so that Apache knows what content to serve for what domain name, or how to get the outside world to be able to access those domains? The latter is more of a DNS configuration issue. – CBroe Apr 08 '15 at 10:14
  • Yeah iam talking about the latter one – Tryhard Apr 08 '15 at 10:23
  • @CBroe I would love if you can make a tutorial on how this is done or at least CBroe explain to me what I have to do I don't know a lot about dns – Tryhard Apr 08 '15 at 10:54
  • @Tryhard You probably need to contact your domain name provider and ask them to configure DNS to point to IP address of your server. – cakan Apr 08 '15 at 12:25
  • @cakan that won't work cuz that will bind one domain to 1 website because the computer has one ip address so I won't be able to put any other different domain or I could but they will point to one website and I'm trying to connect different domains to multiple websites on the same computer so that won't work – Tryhard Apr 08 '15 at 13:37
  • 1
    @Tryhard If you have 5 domains and want to host all of them on the same server, you should point all those 5 domains to the same IP address in DNS. Then, you'll configure your vhosts so that each domain name on that server points to a different directory and you'll have 5 domains with 5 sites hosted on one server. – cakan Apr 08 '15 at 14:05
  • -Then, you'll configure your vhosts so that each domain name on that server points to a different directory and you'll have 5 domains with 5 sites hosted on one server- and how do I do that? – Tryhard Apr 08 '15 at 16:59

1 Answers1

0

If I undestand your 2 similiar question correctly you have already setup 5 Virtual Hosts for your testing purposes.

So lets assume you have example1.dev and example2.dev ... etc setup as Virtual Hosts like this

<VirtualHost *:80>
    DocumentRoot "C:/wamp/example1/www"
    ServerName example1.dev
    ServerAlias www.example1.dev
    Options Indexes FollowSymLinks
    <Directory  "C:/wamp/example1/www">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/wamp/example2/www"
    ServerName example2.dev
    ServerAlias www.example2.dev
    Options Indexes FollowSymLinks
    <Directory  "C:/wamp/example2/www">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Now if you want Apache to serve your .tk domains you need to setup a new Virtual Host for each of the new domains. I would personally suggest that you put these sites in a different folder so you still have your test domains as well as your live domains. So using example1.tk and example2.tk you would create a new Virtual Host for each domain.

Start by copying each domain to a new folder, better still a folder that is not in the \wamp\ directory struture at all. Lets say C:\websrc for example. Then create the new Virtual Hosts in addition to your test domains like so :-

<VirtualHost *:80>
    DocumentRoot "C:/websrc/example1/www"
    ServerName example1.tk
    ServerAlias www.example1.tk
    Options Indexes FollowSymLinks
    <Directory  "C:/websrc/example1/www">
        AllowOverride All
        Require all granted             <- to allow inet access
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/websrc/example2/www"
    ServerName example2.tk
    ServerAlias www.example2.tk
    Options Indexes FollowSymLinks
    <Directory  "C:/websrc/example2/www">
        AllowOverride All
        Require all granted             <- to allow inet access
    </Directory>
</VirtualHost>

Now Apache knows what to serve when it see's your .tk domains.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • Okay first this is not working for me second .tk domains are real will this only work locally? – Tryhard Apr 09 '15 at 10:10
  • Just corrected a typo. But in what way does it not work. Also you need to change `ServerName emaple1.tk` to the real domain names of course. – RiggsFolly Apr 09 '15 at 10:14
  • And for the .tk domains virtual host do I have to edit the hosts file for them like so 127.0.0.1 www.Aaessict.tk? – Tryhard Apr 09 '15 at 10:16
  • No the HOSTS file only applies to the computer that the hosts files lives on. You should have the domain name `aaessict.tk` pointing to your WAN IP whereever you created the `.tk` domain names – RiggsFolly Apr 09 '15 at 10:17
  • okay can you help me in this question http://stackoverflow.com/questions/29535316/wamp-2-5-local-host-doesnt-work-after-i-have-setup-virtual-hosts-i-get-403-forb – Tryhard Apr 09 '15 at 10:22
  • Yes there you go, check the other question – RiggsFolly Apr 09 '15 at 10:26
  • how do you make pictures iwant to ask you a question – Tryhard Apr 09 '15 at 10:31
  • We should go to a chat room, but I cannot remember how to invite you to one – RiggsFolly Apr 09 '15 at 10:34
  • i get this You must have 20 reputation on Stack Overflow to talk here. See the faq. – Tryhard Apr 09 '15 at 10:46
  • can you plz help http://stackoverflow.com/questions/29539553/wamp-server-error-the-filename-directory-name-or-volume-label-syntax-is-inc – Tryhard Apr 09 '15 at 13:20