Previous Thread
Next Thread
Print Thread
Rate Thread
#233945 01/24/2003 8:18 AM
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Sorry but I didn't know where to post this so I chose the installation board

I am running apache experimentally on my computer and I have a question for all of you that know about these things.

I have a public ip address and I have set up my dns entries to map abc.domain.com and def.domain.com to the same address. Now I want to redirect the content of abc.domain.com to a specific document folder, while the def.domain.com to another.

I read in my book that I can do this using virtualhost. The examples though presented are using different IP addresses. Hence the book has:
<VirtualHost 192.168.2.100>
ServerAdmin [][email protected][/]
DocumentRoot c:/www/htdocs/abc
ServerName abc.domain.com
</VirtualHost>
<VirtualHost 192.168.2.101>
ServerAdmin [][email protected][/]
DocumentRoot c:/www/htdocs/def
ServerName def.domain.com
</VirtualHost>


What I want to do is distinguish them differently. Since I have one IP address, I want to do something like this:

<VirtualHost abc.domain.com >
ServerAdmin [][email protected][/]
DocumentRoot c:/www/htdocs/abc
ServerName abc.domain.com
</VirtualHost>

<VirtualHost def.domain.com>
ServerAdmin [][email protected][/]
DocumentRoot c:/www/htdocs/def
ServerName def.domain.com
</VirtualHost>

With IIS you could do this by editing the Header information in the particular website.

Finally I want to achieve that everyone that wants to go to www.domain.com can be redirected if he/she types domain.com (without the www). (My dns entries show the same ip address with or without the www)

Thanks in advance.

Warm regards

Nikos


Nikos
Sponsored Links
Hal_dup2 #233946 01/24/2003 9:59 AM
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
The following should work:
Code
<br />NameVirtualHost *<br /><br /><VirtualHost *><br />ServerAdmin [email protected]<br />DocumentRoot c:/www/htdocs/abc<br />ServerName www.abcdomain.com<br />ServerAlias abcdomain.com<br /></VirtualHost><br /><br /><VirtualHost *><br />ServerAdmin [email protected]<br />DocumentRoot c:/www/htdocs/def<br />ServerName www.defdomain.com<br />ServerAlias defdomain.com<br /></VirtualHost><br />

c0bra #233947 01/24/2003 10:50 AM
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Thanks Gardener for this.

Would it also work if instead of the ServerAlias defdomain.com I put def.domain.com?

I am basically trying to get rid of the www for some other "subdomains" that I have. So for instance when I put instead of www the word dev (dev.domain.com) it will take me to my development site.

Thanks once again

Warm regards

Nikos


Nikos
Hal_dup2 #233948 01/24/2003 11:18 AM
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Yes, you can put any domain (or subdomain) you like as ServerAlias, and you can have as many as you want. Of course, the domain has to point to the IP of your server.


c0bra #233949 01/24/2003 11:30 AM
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Thanks Gardener

I really appreciate this.

Warm regards

Nikos


Nikos
Sponsored Links
Hal_dup2 #233950 01/24/2003 12:25 PM
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Hmmm... I tried this and got stuck.

I created 3 virtual hosts with different servername and documentroot directives. I placed one index.html page on each but with a different context in them to distinguish what goes where.

When I restarted Apache I got this in the log:

[Fri Jan 24 17:17:21 2003] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Fri Jan 24 17:17:21 2003] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Fri Jan 24 17:17:21 2003] [warn] _default_ VirtualHost overlap on port 80, the first has precedence

Whenever I put on the browser abc.domain.com or def.domain.com or ghi.domain.com it always picks up the index.html page which is located in my main documentroot path and doesn't get redirected.

Now if I put something like abc.domain.com/forum/login.php it brings up the login page

Really puzzled.... Are these errors normal?

Thanks in advance for any suggestions

Warm regards

Nikos


Nikos
Hal_dup2 #233951 01/24/2003 12:40 PM
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I got it working in the end but it is really slow!

It takes a bit of waiting for the pages to appear (listing of categories and forums), while with IIS this was instant.

I also keep on getting some errors:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE in
C:\www\htdocs\ffff\forum\ubbt.inc.php on line 64

Fatal error: Call to undefined function: getmicrotime() in
c:\www\htdocs\ffff\forum\main.inc.php on line 16

when clicking the General Discussion board. If I press F5 there and then, the page shows up fine!

I know that this is something new for me and I know that IIS was better (compared to what Apache is now) but I am not giving up! I need to know which server is the best and I will find out the hard way.

I suspect that there are a lot of tuning directives (I haven't read that chapter in my book) and I will exploit them all before I move my forum to my new server.

Any personal suggestions or points to resources on the Internet are more than welcome

Warm regards

Nikos


Nikos
Hal_dup2 #233952 01/24/2003 1:25 PM
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
It should be instant and you are getting some weird errors. If you want, you can send me your config file and I'll take a look at it.

c0bra #233953 01/24/2003 1:33 PM
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Thanks Gardener.

It's in the post

Warm regards

Nikos


Nikos
Hal_dup2 #233954 01/26/2003 3:49 AM
Joined: Oct 2000
Posts: 2,665
Veteran
Veteran
Offline
Joined: Oct 2000
Posts: 2,665
I was wondering how I could create a domaine locally without going thru setting external dns ans stuff. Can that be done with the windows dns daemon? (create a lookback on a false domaine name)


Do you believe in love at first sight,
or should I walk by again?
Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Shock Hosting
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,834
Joined: January 2000
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,824
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 1336
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 3
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)