IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Serving multiple sites from a single host (Apache)
This is more of a "which way should I be focusing" rather than a "tell Thane how to do it" thread.

Let's say a generic college wants to put up two sites, [link|http://blogs.college.edu|http://blogs.college.edu] and and [link|http://wiki.college.edu|http://wiki.college.edu]. Both will be served off the same box.

Do I need to assign 2 IP addresses to that box, and then assign traffic to the appropriate website based on which IP address is getting hit, or can traffic be redirected based on the name the browser requested originally?
When somebody asks you to trade your freedom for security, it isn't your security they're talking about.
New As long as the server and client are using http 1.1
they can be served off the same box with the same IP address.

I do this myself using web/2 ([link|http://dink.org|http://dink.org]) on warp, let alone apache on (presumably) linux. You have to configure the server to recognise different sites, and typically you'll have a file tree for each site, with a pointer in the config files tying together name and folder.

I can tell you how to do this in web/2 in thirty seconds, but I'm not so up on my apache-fu. Still, it shouldn't be too hard to find out how to do this in the docs. It may even be that a quick perusal of the actual config files might have all the info you need to set it up.
--\n-------------------------------------------------------------------\n* Jack Troughton                            jake at consultron.ca *\n* [link|http://consultron.ca|http://consultron.ca]                   [link|irc://irc.ecomstation.ca|irc://irc.ecomstation.ca] *\n* Kingston Ontario Canada               [link|news://news.consultron.ca|news://news.consultron.ca] *\n-------------------------------------------------------------------
New Thanks!
New Apache can do name-based matching.
For example, in my httpd.conf, I have the following snippets:
Listen 192.168.0.30:80\nBindAddress myname.com\nBindAddress www.myname.com\nBindAddress wine.myname.com\n\n[...]\n\n####################\n# www.myname.com\n####################\n<VirtualHost *>\n    ServerName www.myname.com\n    ServerAdmin webmaster@myname.com\n    DocumentRoot /var/vhosts/myname\n    ScriptAlias /cgi-bin/ /var/vhosts/myname/cgi-bin/\n    ErrorLog /var/log/apache/myname-error.log\n    CustomLog /var/log/apache/myname-access.log common\n    CustomLog /var/log/apache/myname-agent.log agent\n</VirtualHost>\n\n####################\n# wine.myname.com\n####################\n<VirtualHost *>\n    ServerName wine.myname.com\n    ServerAdmin webmaster@myname.com\n    DocumentRoot /var/vhosts/wine\n    ScriptAlias /cgi-bin/ /var/vhosts/wine/cgi-bin/\n    ErrorLog /var/log/apache/wine-error.log\n    CustomLog /var/log/apache/wine-access.log common\n</VirtualHost>
Note that I have changed any kind of essential information, and so may have introduced some minor typos. However, that's basically the gist of how you'd do it.

If you go to [link|http://myname.com/|http://myname.com/] or [link|http://www.myname.com/|http://www.myname.com/], you will get the same site (configuration information for plain old "myname.com" not shown above, but is the same as for "www.myname.com".) If you go to [link|http://wine.myname.com/|http://wine.myname.com/], you will get a login screen for my wine database application that I set up a couple years back and have sorely neglected since then.

Yes, yes, I know that you weren't looking for actual code to do it, but it was actually at my fingertips since I was just hackin' around in there earlier.
-YendorMike

"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
- Benjamin Franklin, 1759 Historical Review of Pennsylvania
New Slightly better
If you start doing virtual hosts, you can have the conf file read the vhost entries from a directory. Each file in the vhost directory is a file that just contains the VirtualHost stanza. Typically the contents would actually be symlinks to the actual files in a /home/vhost/sitename directory. This way you can give each site maintainer access to their own configs.

For what Thane needs, this may be overkill. But it's not so hard to do that it's not worth looking at. See [link|http://httpd.apache.org/docs/1.3/vhosts/examples.html|here] for the Apache 1.3 docs and [link|http://httpd.apache.org/docs/2.0/vhosts/examples.html|here] for the 2.0 docs. They're quite good.
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
New Thanks.
I've actually got the third edition Apache definitive guide from O'Reilly on hand, so it's all good - just wanted some direction as towards where to look.
When somebody asks you to trade your freedom for security, it isn't your security they're talking about.
New From the Imric the Lame
I've always had success using webmin-apache to set this up; I'm running multiple domains as well as hosts of the same box. It's pretty easy, too.
[link|http://www.runningworks.com|
]
Imric's Tips for Living
  • Paranoia Is a Survival Trait
  • Pessimists are never disappointed - but sometimes, if they are very lucky, they can be pleasantly surprised...
  • Even though everyone is out to get you, it doesn't matter unless you let them win.


Nothing is as simple as it seems in the beginning,
As hopeless as it seems in the middle,
Or as finished as it seems in the end.
 
 
New Agreed
I've never taken the time to split up my httpd.conf file into multiple vhost files. I rarely change it as it is, and since it's just a single-user server, I don't really see a need to do the work for no real reward.
-YendorMike

"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
- Benjamin Franklin, 1759 Historical Review of Pennsylvania
New I am serving about 30 so far...
All are fronted by Apache2.

Some are just plain Virtual Hosts with name based matching.

Some are Rewriting hosts (Z is one of them)

A couple are just plain reverse-proxy forwards.

If you want, I could hook you up with a "read" only account to take a look at the setup used on my machine.

It can be very complicated... but in the end it is all quite logical.
--
[link|mailto:greg@gregfolkert.net|greg],
[link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey
Freedom is not FREE.
Yeah, but 10s of Trillions of US Dollars?
SELECT * FROM scog WHERE ethics > 0;

0 rows returned.
     Serving multiple sites from a single host (Apache) - (inthane-chan) - (8)
         As long as the server and client are using http 1.1 - (jake123) - (1)
             Thanks! -NT - (inthane-chan)
         Apache can do name-based matching. - (Yendor) - (4)
             Slightly better - (drewk) - (3)
                 Thanks. - (inthane-chan) - (1)
                     From the Imric the Lame - (imric)
                 Agreed - (Yendor)
         I am serving about 30 so far... - (folkert)

There ARE supposed to be two as-es there!
134 ms