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 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
     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)

All your very long procedures are now belong to us.
117 ms