Two or more webs at home
John D Jones III
unixgeek1972 at gmail.com
Thu Apr 23 20:18:59 MDT 2009
Michael Torrie wrote:--
Gary Thornock wrote:
--- On Wed, 4/22/09, Jones, Scott (GE Money, consultant) [1]<Scott.1Jones at ge.co
m> wrote:
Is it possible to host/serve/run two or more web sites at one
location with one static IP?
I have my web but my three boys will soon want to set up their
own web sites and update and manage each on their own. Can
these all run from my home network? These will not likely be
commerce sites, but just fun, more or less static sites for my
boys to get their feet wet.
Am I thinking of virtual servers? What are the possibilities
here?
Not only possible but easy. In a stock Apache httpd.conf,
search for the keyword "NameVirtualHost". There are pretty
good instructions right in the comments in the file.
One technique I use to provide SSL access for a couple of different
virtual hosts is to use different ports. domain A would be
[2]https://A.domain:1443, domain B could be [3]https://B.domain:2443. Not
super clean, but it works pretty well, especially if you're direction
traffic to SSL from a non-ssl page to begin with.
/*
PLUG: [4]http://plug.org, #utah on irc.freenode.net
Unsubscribe: [5]http://plug.org/mailman/options/plug
Don't fear the penguin.
*/
Apache's VirtualHosts are the way to go, for sure, you can use
multiple domain names, create sub domains, whatever, just make sure
the DNS for the subs and/or otherdomains point to the correct IP. Some
examples taken from a working Apache 2.2 configuration below:
<VirtualHost *:80>
ServerName somesub.mysite.org
ServerAlias sub.mysite.org s3.mysite.org
DocumentRoot "/usr/local/www/somesub"
ServerAdmin [6]email at address.tld
<Directory "/usr/local/www/somesub">
Options Indexes
Allow from all
Order allow,deny
AllowOverride None
</Directory>
</VirtualHost>
<VirtualHost *:80>
SetEnv RAILS_ENV development
ServerName rails.mysite.org
DocumentRoot /usr/local/www/rails/public
ErrorLog "/var/log/rails-errors.log"
<Directory /usr/local/www/rails/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# Non Main Domains
<VirtualHost *:80>
ServerName [7]www.someotherdomain.com
DocumentRoot "/home/othersite/public_html"
ServerAdmin [8]email at address.tld
ServerAlias someotherdomain.com *.someotherdomain.com
<Directory "/home/othersite/public_html">
Options Indexes FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Hope this helps. One thing to note, I've noticed that you want to put
all otherdomain directives after all mainsite subdomains, Apache seems
to freak out and just display the first VirtualHost directive if
not...
References
1. mailto:Scott.1Jones at ge.com
2. https://A.domain:1443/
3. https://B.domain:2443/
4. http://plug.org/
5. http://plug.org/mailman/options/plug
6. mailto:email at address.tld
7. http://www.someotherdomain.com/
8. mailto:email at address.tld
More information about the PLUG
mailing list