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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 28th, 2001, 02:27 PM
khomar khomar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 7 khomar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

Greetings.

I am trying to set up a web site with several independant sub-sites for demonstrations. Each of these sub-sites needs to have its own document root and cgi-bin. I would like to use only one server name and port, but use a directory structure to link to each site. I would also like to keep all of these virtual sites on a single server.

For example, I could have two demo sites each reached by going to the following URLs:

http://www.mysite.com/demo1/home.html
http://www.mysite.com/demo2/home.html

Everything under demo1 would run its own isolated area from demo2 including all aliases. I don't think this should be too difficult, but I can't seem to find anywhere in the documentation to do this sort of mapping (only name based and IP based). Does anyone know how to do this?

Thanks in advance.

Khomar

[Edited by khomar on 02-28-2001 at 01:29 PM]

Reply With Quote
  #2  
Old February 28th, 2001, 06:12 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
You haven't provided the docroot for demo* site. Here is an example that assumes demo* is a user account:

AliasMatch ^/([^/]*)/?(.*) /home/$1/public_html/$2
DirectoryIndex home.html

This actually converts http://www.mysite.com/~username/home.html to http://www.mysite.com/username/home.html

Reply With Quote
  #3  
Old February 28th, 2001, 06:41 PM
khomar khomar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 7 khomar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
freebsd,

Yeah, I thought about using the alias', but the problem is that it does not translate the documentment root or cgi-bin to the new directory. Let me try this again:

We have the following URL's:

http://www.mysite.com/demo1/home.html
http://www.mysite.com/demo2/home.html

These would actually map to:
/home/demos/demo1/
/home/demos/demo2/

with my actual home page at:
/home/httpd

All of these directories would have their own cgi-bin and html sub-directories. Once the user (or one of my pages) entered a URL starting with http://www.mysite.com/demo1/, Apache would treat all subsequent pages as if it was a completely separate server. In this way, when the software running in the cgi-bin directory would make a call to a file in the html directory (ie <img src="/icons/something.gif"> ), it would actually look for this file under the /home/demos/demo1/html/icons directory instead of /home/httpd/html/icons.

http://www.mysite.com/demo1/icons/something.gif
--> /home/demos/demo1/html/icons/something.gif

http://www.mysite.com/demo2/icons/something.gif
--> /home/demos/demo2/html/icons/something.gif

http://www.mysite.com/icons/something.gif
--> /home/httpd/html/icons/something.gif


Does this make sense? Is this possible?


Reply With Quote
  #4  
Old February 28th, 2001, 07:48 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
>> These would actually map to:
>> /home/demos/demo1/
>> /home/demos/demo2/

Don't do that. Instead, create a public_html directory at: /home/demos/public_html/demo*/ for permission+security.
A proper ~user directory might contain multiple subdirectories, and you definitely don't want to map wildcard subdirs of that for security reasons.
There should also be a global UserDir public_html directory requires that UserDir cannot be empty. As you can see, demo1 and demo2 don't match.

Next, change /home/$1/public_html/$2 to /home/demos/public_html/$2

>> All of these directories would have their own cgi-bin and html sub-directories

The $2 takes everything after /home/demos/public_html/* including subdirs.

>> with my actual home page at: /home/httpd

This is fine since you are mapping only the dirs under public_html of the user demos.

>> would make a call to a file in the html directory (ie <img src="/icons/something.gif"> )

You can't do that. /icons/something.gif is a relative URL to http://www.mysite.com/, not what you wanted as http://www.mysite.com/demo1/
BTW, /icons directory is reserved for global use, you should never use the name icons, try something else like images, just don't use icons.

Try this: Alias /*/icons/ "/home/httpd/icons/"

As for cgi-bin dir, you can add this:

ScriptAliasMatch ^/*/cgi-bin/ /home/demos/public_html/$1/cgi-bin/

So that http://www.mysite.com/demo2/cgi-bin/ would be mapped to /home/demos/public_html/demo2/cgi-bin/


[Edited by freebsd on 02-28-2001 at 07:00 PM]

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Mapping directories to their own site


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 6 hosted by Hostway