Closed Thread Icon

Topic awaiting preservation: Virtual Hosts with Apache Pages that link to <a href="https://ozoneasylum.com/backlink?for=12973" title="Pages that link to Topic awaiting preservation: Virtual Hosts with Apache" rel="nofollow" >Topic awaiting preservation: Virtual Hosts with Apache\

 
Author Thread
marf
Bipolar (III) Inmate

From: Canada
Insane since: Oct 2001

posted posted 11-07-2003 01:13

This seemed like the best forum to post this topic


Ok I recently bought another domain name.

Now lets say I have 2 domains

mydomain.org

which is my primary domain and when accessed it loads webpages from my server box in /var/www/html


I just bought

mydomain2.com


and Then i went into /etc/httpd/config/ httpd.conf
which is the apache configure file

and I added the lines....

Code:
--------------------------------------------------------------------------------

<VirtualHost *:80>
ServerName mydomain2.com
DocumentRoot /var/www/virtual/mydomain2
</VirtualHost>

--------------------------------------------------------------------------------


now should this not accept anything with that domain, and make it access from that document root?

And yes i made sure that 'mydomain2.com' points towards my ip address.

IS it posisble to have to domain names point to one IP address? I have virtual hosts working fine for the first domain.

ie.

test.mydomain.org

works when I use the following in the httpd.conf

Code:
--------------------------------------------------------------------------------

<VirtualHost *:80>
ServerName test.mydomain.org
DocumentRoot /var/www/virtual/test
</VirtualHost>

--------------------------------------------------------------------------------

Any Suggestions? I believe i just have to do soemthing different with my Virtual hosts code.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 11-07-2003 01:27

It should already be configured but you also need

NameVirtualHost *

in your httpd.conf the * can be your IP as well but the wildcard should work fine. Name based hosting is actually recommended over IP based.



.:[ Never resist a perfect moment ]:.

Ducati
Paranoid (IV) Inmate

From: in your head
Insane since: Feb 2001

posted posted 11-07-2003 07:20

Yes, it is possible to have many domains pointed to the same IP addy. Your webhost should do it for you.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 11-07-2003 12:40

ducati: seems marf's his own host.

All I can think is that 'ServerName mydomain2.com' will only match exactly 'mydomain2.com'... you'll probably want *.mydomain2.com, so that www.mydomain2.com is also served from the right directory (and not from the default virtual host (usually the first one)).

holler, if you still can't get it to work,
TP

PS: domain name ip updates usually take at least 24h till they're effective world-wide.

marf
Bipolar (III) Inmate

From: Canada
Insane since: Oct 2001

posted posted 11-07-2003 16:44

Ok im at school right now. Once i get home i'm gonna play with it and try to fix it.

marf
Bipolar (III) Inmate

From: Canada
Insane since: Oct 2001

posted posted 11-07-2003 21:20

Ok I now have it partially working.

when i type ' http://mydomain2.com' inthe address bar it works, but when i type ' http://www.mydomain2.com '
it doens't work

I tried adding to the nameservers

Nameservers *.mydomain2.com

ie...

code:
#New domain Here

<VirtualHost *>
ServerName *.mydomain2.com
DocumentRoot /var/www/virtual/mydomain2
</VirtualHost>



But that didn't work

Any suggestions?

[This message has been edited by marf (edited 11-07-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu