Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 11th, 2002, 02:54 PM
sweeting sweeting is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Payson, UT, United States
Posts: 28 sweeting User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to sweeting Send a message via Yahoo to sweeting
Setting up sub domains in apache

I am using Apache on Windows 2000, I currently have a webhost, Modwest.com, that allows unlimited sub domains. In their system, all I have to do is add anotherdirectory under the htdocs directory to create a sub domain. The inifial directories created in the htdocs directory are "www" and "_" -- which points to "www" so my site can be accessed through www.domain.com or just domain.com. Furthermore, if I have the following directories under htdocs, (sub1, sub2, sub3) I can access the files in those directories by going to sub1.domain.com, sub2.domain.com, sub3.domain.com.

Is this something that is possible to set up on my Apache/Windows 2000 configuration?

Last edited by sweeting : March 11th, 2002 at 02:57 PM.

Reply With Quote
  #2  
Old March 11th, 2002, 03:38 PM
mezz mezz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 310 mezz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Yes, it's possible so try to read about vhost at http://httpd.apache.org/docs/vhosts/index.html .. If you can't understand or have problem, then post in here again..

Reply With Quote
  #3  
Old March 11th, 2002, 03:39 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 184
of course it is!
this seems to me like a simple php/perl script setting up DNS entries in (99% confident) /var/named/ and virtualhosts (40%) /etc/httpd/virtual.conf

you can search in this forum for "url rewriting", the most recent posts answered by freebsd contain the exact way if i remember correctly.
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #4  
Old March 11th, 2002, 03:58 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Something like this:
Code:
RewriteEngine	on
RewriteMap      lc              int:tolower
RewriteCond   %{HTTP_HOST}    ^domain\.com$ [NC]
RewriteRule   ^(.+)             - [L]
RewriteCond   %{HTTP_HOST}    !\.domain\.com$ [NC]
RewriteRule   ^(.+)             - [L]
RewriteCond   %{HTTP_HOST}    ^[^.]+\.domain\.com$ [NC]
RewriteRule   ^/icons/(.+)      - [PT,L]
RewriteRule   ^(.+)             %{HTTP_HOST}=$1 [C]
RewriteRule   ^(.*)=(.*)        ${lc:$1}$2 [C]
RewriteRule   ^([^.]+)\.domain\.com(.*) /server/path/to/htdocs/$1$2


>> all I have to do is add anotherdirectory under the htdocs directory

This is a bad setup and not efficient. You should move them one directory level up.

Reply With Quote
  #5  
Old March 12th, 2002, 12:42 AM
sweeting sweeting is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Payson, UT, United States
Posts: 28 sweeting User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to sweeting Send a message via Yahoo to sweeting
Okay, I have been looking at configurations at this URL:
http://httpd.apache.org/docs/vhosts/mass.html

The text there seems to be what I am wanting to do...

Quote:
The basic idea is to replace all of the static <VirtualHost> configuration with a mechanism that works it out dynamically. This has a number of advantages:

1. Your configuration file is smaller so Apache starts faster and uses less memory.
2. Adding virtual hosts is simply a matter of creating the appropriate directories in the filesystem and entries in the DNS - you don't need to reconfigure or restart Apache.


The problem is, I am not sure which one to use. I tried putting the following in my httpd.conf, but it didn't work.

Code:
RewriteEngine	on
RewriteMap      lc              int:tolower
RewriteCond   %{HTTP_HOST}    ^domain\.com$ [NC]
RewriteRule   ^(.+)             - [L]
RewriteCond   %{HTTP_HOST}    !\.domain\.com$ [NC]
RewriteRule   ^(.+)             - [L]
RewriteCond   %{HTTP_HOST}    ^[^.]+\.domain\.com$ [NC]
RewriteRule   ^/icons/(.+)      - [PT,L]
RewriteRule   ^(.+)             %{HTTP_HOST}=$1 [C]
RewriteRule   ^(.*)=(.*)        ${lc:$1}$2 [C]
RewriteRule   ^([^.]+)\.domain\.com(.*) /server/path/to/htdocs/$1$2


Note: I uncommented the line:
"LoadModule rewrite_module modules/mod_rewrite.so"
and I adjusted the domain.com to my domain name.

When I restarted Apache after this, I received this error:
Quote:
Invalid command 'RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration.


Any help with this would be appreciated. By the way, please remember that I am using Apache on WINDOWS.

Thanks!

Reply With Quote
  #6  
Old March 12th, 2002, 08:09 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> I am not sure which one to use

Try them both, they both are dynamic without restarting Apache.

>> Invalid command 'RewriteEngine'

Then mod_rewrite is not available. Keep in mind, mod_rewrite is not a default module.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Setting up sub domains in apache


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT