Author |
|
notaloafer
Joined: 31 May 2007 Posts: 17 Location: Anacortes
|
Posted: Sat 15 Sep '07 6:54 Post subject: Virtual Hosting (vhost_alias module) |
|
|
Hey guys I have a somewhat complicated thing I'm trying to do using my home server... here's the lowdown.
I just installed vhost_alias module (for doing dynamic virtual hosts). Basically I'm really lost on how the whole thing works so I'll describe what I have right now:
I have one central webmail system located in /var/www/webmail
I need all of my websites located in /var/www/hostedsites/sitename/ to automatically map the domain names to the right folder. My DNS records are already set up.
I have already set it up so (example) typing notaloafer.com will automatically point directly to /var/www/hostedsites/notaloafer.com/ and the domain shows up correctly. I can add any folder such as example1 and if I control the example1 domain it will automatically map to that folder.
Problem 1: When you try to put in www. in front of any of the domain names they do not map and you get the "the url "/" cannot be found on this server" message.
Problem 2: I want it so that ANY domain name that I control, the email.domainname will point to the /var/www/webmail folder automatically without me having to configure additional vhost containers.
Your support is well-appreciated! If I missed something in describing my issue please tell me
-Eric
Another thing: eventually I will be hosting a ton of websites that kids made for my school and will need the ability to automatically map subdomains.
Such as: kid1.notaloafer.com will automatically map to /var/www/hostedsites/subs/kid1
So basically what I'm asking is for a way so when I create the "kid1" folder in the subs folder, the subdomain kid1.notaloafer.com automatically points to that folder. |
|
Back to top |
|
notaloafer
Joined: 31 May 2007 Posts: 17 Location: Anacortes
|
Posted: Tue 18 Sep '07 5:56 Post subject: |
|
|
Bump..? =S |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7298 Location: Germany, Next to Hamburg
|
|
Back to top |
|
notaloafer
Joined: 31 May 2007 Posts: 17 Location: Anacortes
|
Posted: Wed 19 Sep '07 2:01 Post subject: |
|
|
I'm trying to get around having to make Vhosts for every domain I have. That's the entire point of doing it dynamically...
-Eric. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7298 Location: Germany, Next to Hamburg
|
Posted: Wed 19 Sep '07 10:05 Post subject: Re: Virtual Hosting (vhost_alias module) |
|
|
notaloafer wrote: |
Problem 1: When you try to put in www. in front of any of the domain names they do not map and you get the "the url "/" cannot be found on this server" message.
|
use ServerAlias
Problem 2: I want it so that ANY domain name that I control, the email.domainname will point to the /var/www/webmail folder automatically without me having to configure additional vhost containers.
Maybe there is a solution with rewriting AFAIK. google is your friend or you may ask here http://forum.modrewrite.com/
|
|
Back to top |
|
notaloafer
Joined: 31 May 2007 Posts: 17 Location: Anacortes
|
Posted: Wed 19 Sep '07 21:38 Post subject: |
|
|
I can see how that would work (using ServerAlias) but how would I set it up in my case? I'm very confused on all of this!
Thanks
-Eric |
|
Back to top |
|
rlttharp
Joined: 04 Jul 2007 Posts: 12 Location: Chicago, IL Jonesboro, AR
|
Posted: Wed 19 Sep '07 23:27 Post subject: Vittual Sever |
|
|
You can not use www.thename.com you have to use thename.com the www is assumed, so when you create the virtual server just use thename.com ok |
|
Back to top |
|
notaloafer
Joined: 31 May 2007 Posts: 17 Location: Anacortes
|
Posted: Thu 20 Sep '07 0:12 Post subject: |
|
|
That is a very bad idea. if I do that and someone types in notaloafer.com then it does it the other way around and the person will not get the website, and end up leaving. Do I want that? no! there has to be a fix! lol. |
|
Back to top |
|
rlttharp
Joined: 04 Jul 2007 Posts: 12 Location: Chicago, IL Jonesboro, AR
|
Posted: Thu 20 Sep '07 18:48 Post subject: Virtual Setup |
|
|
Lets get on the same page here OK. Your are trying to setup a virtual host so you must be editing your httpd.conf file right ? |
|
Back to top |
|
notaloafer
Joined: 31 May 2007 Posts: 17 Location: Anacortes
|
Posted: Fri 21 Sep '07 3:16 Post subject: |
|
|
I am trying to setup a dynamic virtual hosting situation. I already have like 20 vhost containers and I want to take all of thsoe and condense them down to 1-3 which should be possible using mod_vhost_alias.... I should be able to have it automatically know what websites I have in my directive /var/www/hostedsites/sitename.com and people should be able to type in www.sitename.com OR sitename.com and access the site. This should only take a few lines in my hosts.conf file using mod_vhost_alias.
Sorry if there was any confusion.
-Eric |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7298 Location: Germany, Next to Hamburg
|
Posted: Fri 21 Sep '07 9:41 Post subject: |
|
|
You should search in the forum for mod macro and have a look at
<VirtualHost *>
ServerName server.domain.com
ServerAlias server server2.domain.com server2
# ...
</VirtualHost> |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Fri 21 Sep '07 14:52 Post subject: |
|
|
Doesn't this mod_vhost_alias directive do what you want?
Code: | VirtualDocumentRoot "/var/www/hostedsites/subs/%-3" |
This directive should map all the following hostnames to /var/www/hostedsites/subs/kid1 based on the 3rd-to-last part of the hostname (kid1): kid1.notaloafer.com
www.kid1.notaloafer.com
webmail.kid1.notaloafer.com
lots.of.stuff.kid1.notaloafer.com
-tom- |
|
Back to top |
|
rlttharp
Joined: 04 Jul 2007 Posts: 12 Location: Chicago, IL Jonesboro, AR
|
Posted: Fri 21 Sep '07 22:35 Post subject: Virtual Server |
|
|
tdonovan is going in the right direction this is what I was refering to also. You will get errors or a virtual host that will not work by naming it WWW.ANYTHING.COM its has to be ANYTHING.COM and then the allis directive so you can have several NAMES pointing to that virtual host container. even if you only have one name the sever ANYTHING.COM and then one allis of WWW.ANYTHING.COM |
|
Back to top |
|
notaloafer
Joined: 31 May 2007 Posts: 17 Location: Anacortes
|
Posted: Mon 24 Sep '07 1:46 Post subject: |
|
|
Here is what I have right now in my hosts.conf file:
Code: |
<VirtualHost *>
ServerName email.notaloafer.com
ServerAdmin eric@notaloafer.com
DocumentRoot /var/www/webmail/
<Directory /var/www/webmail/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName tkdesign.notaloafer.com
ServerAlias tkdesign.notaloafer.com *.tkdesign.notaloafer.com
ServerAdmin code_girl@hotmail.com
DocumentRoot /var/www/hostedsites/tk/
<Directory /var/www/hostedsites/tk/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName clantriv.com
ServerAlias clantriv.com www.clantriv.com
ServerAdmin eric@notaloafer.com
DocumentRoot /var/www/hostedsites/clantriv.com/
<Directory /var/www/hostedsites/clantriv.com/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName email.clantriv.com
ServerAdmin eric@notaloafer.com
DocumentRoot /var/www/webmail/
<Directory /var/www/webmail/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName d2tbpk.com
ServerAdmin d2tbpk@hotmail.com
ServerAlias d2tbpk.com www.d2tbpk.com
DocumentRoot /var/www/hostedsites/d2tbpk.com/
<Directory /var/www/hostedsites/d2tbpk.com/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName email.d2tbpk.com
ServerAdmin d2tbpk@hotmail.com
DocumentRoot /var/www/webmail/
<Directory /var/www/webmail/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName ohafh.com
ServerAlias ohafh.com www.ohafh.com oakharborafh.com www.oakharborafh.com www.oakharboradultfamilyhome.com oakharboradultfamilyhome.com
ServerAdmin suzanbartlett@gmail.com
DocumentRoot /var/www/hostedsites/ohafh.com/
<Directory /var/www/hostedsites/ohafh.com/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName anacorteskeyclub.com
ServerAlias anacorteskeyclub.com www.anacorteskeyclub.com
ServerAdmin eric@anacorteskeyclub.com
DocumentRoot /var/www/hostedsites/anacorteskeyclub.com/
<Directory /var/www/hostedsites/anacorteskeyclub.com/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName email.anacorteskeyclub.com
ServerAdmin eric@anacorteskeyclub.com
DocumentRoot /var/www/webmail/
<Directory /var/www/webmail/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
|
Here is what I want to do:
1) make it so email.anydomainihost.com points to /var/www/webmail/
2) make it so anydomainihost.com points to /var/www/hostedsites/anydomainihost.com
3) make it so www.anydomainihost.com points to /var/www/hostedsites/anydomainihost.com
I somewhat understood what you posted before with your VirtualDocumentRoot container and it somewhat worked, but I'm still missing something....
Thanks guys!
-Eric
By the way: In case I didn't clarify before, I only have 1 server serving DNS and the same server is also hosting the websites. I can setup my DNS records however you guys need to get done what I want, just specify what needs to be done if needed. |
|
Back to top |
|
notaloafer
Joined: 31 May 2007 Posts: 17 Location: Anacortes
|
Posted: Wed 26 Sep '07 6:26 Post subject: |
|
|
By the way the only reason I ask for such specific help is I'm trying to avoid downtime here... I have a few people that depend on the server and I get yelled at for taking it offline
Thanks!!
-Eric |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7298 Location: Germany, Next to Hamburg
|
|
Back to top |
|