|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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] |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
>> 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] |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Mapping directories to their own site |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|