FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Directory Based vHosts?





cr3ativ3
Hey,

I am trying to configure a server at my house, as this somewhat relates to the hosting here, I have posted in this forum.

I am trying to determine how to run virtual hosts on my linux box, which is running Debian Etch and has apache 2/2.2 installed. The configuration I am looking for is to allow users to access their sites over one ip address and 1 port, but instead by seperating the sites by the directory being called.

Now this is done with DirectAdmin aswell as cPanel, so people can access their sites while the DNS on the domain resolves.

directadmin wrote:
ip/~username/domain


or

cpanel wrote:
ip/~username/


Now from what I know apache only has 3 types of virtualhosts, Domain/ServerName, Ip-Based, and Port-Based. Non of which I am looking for in my "intranet" server.

My current way of solving this is to add records into the httpd.conf to rewrite the folder.

Code:

<VirtualHost _default_>
RewriteEngine On
RewriteRule ^/~([a-z]+)/(.*)$ /home/$1/public_html/$2
RewriteRule ^/~([a-z]+)$ /home/$1/public_html/

   <Directory /home/user1/>
      Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
      php_admin_value open_basedir /home/user1/
   </Directory>
   <Directory /home/user2/>
      Options FollowSymLinks
      AllowOverride All
      Order allow,deny
                allow from all
      php_admin_value open_basedir /home/user2/
   </Directory>
</VirtualHost>


But this has its limitations, I cant use <Directory> to work with suExec features. So my question just comes down to how does DirectAdmin and cPanel create "Directory Based" virtual hosts?

Maybe if you can post some samples from the frihost servers, that might be more helpfull, as I do alot of learning by example.

I appreciate any help you can yeild!
rvec
http://httpd.apache.org/docs/2.0/vhosts/mass.html
that'll help you Smile
cr3ativ3
rvec wrote:
http://httpd.apache.org/docs/2.0/vhosts/mass.html
that'll help you Smile


I am not sure that accomplishes what I am trying to do....That seems to use the ServerName to divide up the virtualhosts.

I.E.

Vhost1: www.domain1.com/file.txt
Vhost2: www.domain2.com/file.txt

All that does is change the server side path to the document root...instead of /home/joe/www.domain1.com/file.txt to something like /home/joe/domain1/file.txt

I am trying to create a server that lets all the virtual hosts access the server on a single ip address (not seperate for each user), same port number 80 (not different for each host), and i'm not even dealing with domains, as this is targetted toward a intranet.

I am trying to divide the virtual hosts up by the the URI (the folder being called "/~username/file.txt")


Frihost: Your Account Is Ready For Use [Email] wrote:

IP: 64.92.163.26
Use 64.92.163.26/~username/domain to access it until the domain resolves.
rvec
read the whole page. There's even a part where they explain wildcards, which would make it work even if you have some really strange setup.

Keep reading:
http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html

good luck Razz
cr3ativ3
rvec wrote:
read the whole page. There's even a part where they explain wildcards, which would make it work even if you have some really strange setup.

Keep reading:
http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html

good luck Razz


I'm sorry but I still dont see how this helps me Sad.

Can I see some samples of actual DirectAdmin/cPanel directory based vHosts?
cr3ativ3
How about I show a sample of one of the vHosts I have now and then you can help me out with converting it over to a directory-based solution.

Current Sample vHost:
Code:

Listen 8888
NameVirtualHost *:8888

<VirtualHost *:8888>
_ ServerAdmin webmaster@example1.com
_ DocumentRoot /var/www/web1/web/

_ <IfModule mod_fcgid.c>
___ SuexecUserGroup web1 web1
___ PHP_Fix_Pathinfo_Enable 1
___ <Directory /var/www/web1/web/>
____ Options +ExecCGI
____ AllowOverride All
____ AddHandler fcgid-script .php
____ FCGIWrapper /var/www/php-fcgi-scripts/web1/php-fcgi-starter .php
____ Order allow,deny
____ Allow from all
___ </Directory>
_ </IfModule>

_ # ErrorLog /var/log/apache2/error.log
_ # CustomLog /var/log/apache2/access.log combined
_ ServerSignature Off

</VirtualHost>



Current method of requestion a page: "http://192.168.0.111:8888/page.php"

Method desired: "http://192.168.0.111/~web1/page.php"

k?
rvec
oh that's not a vhost, that's more like an alias.
I think that should make an url look like this:
http://192.168.0.111/web1/page.php
and look for the file on:
http://192.168.0.111/web1/web/page.php

have mod_rewite loaded and try this:
RewriteRule ^/(.*)/$ /$1/web/

Then just have the documentroot in /var/www

not sure what you want with the port, why not set it to 80?
cr3ativ3
rvec wrote:
oh that's not a vhost, that's more like an alias.
I think that should make an url look like this:
http://192.168.0.111/web1/page.php
and look for the file on:
http://192.168.0.111/web1/web/page.php

have mod_rewite loaded and try this:
RewriteRule ^/(.*)/$ /$1/web/

Then just have the documentroot in /var/www

not sure what you want with the port, why not set it to 80?


Ya thats what I am currently doing, as stated in my first post...the problem with doing this is I cant dynamically change things like the suExec wrapper...which needs to be changed per alias (i guess).
cr3ativ3
I'm trying to determine how I change the following based on the directory or URI being called.

Code:
SuexecUserGroup web1 web1


So if 192.168.0.111/~web1/index.php is being called then that line is:


Code:
SuexecUserGroup web1 web1


but if 192.168.0.111/~web24/index.php is being called then that line should be:

Code:
SuexecUserGroup web24 web24


how would I set it up to do that? As I cant use SuexecUserGroup within the <Directory></Directory> tags.

And how would I do the same for DocumentRoot as that cant be changed either...
cr3ativ3
Sorry I keep replying to my thread, but I have done some more searching and I came across this patch in the apache stuff..

http://mail-archives.apache.org/mod_mbox/httpd-dev/200308.mbox/%3C20030901003301.GA23752@castlerea.stdlib.net.%3E

However, I dont know how to download the attached files or install them on my box..., when I download those files they appear to be empty...among other things.

Let me know Smile, i'm gonna take a wild a guess and when they mention "not least a large client Wink", they are referring to cPanel.

Thanks!
rvec
hmm that thread is kinda old, you sure it isn't implemented in the newest apache?
cr3ativ3
rvec wrote:
hmm that thread is kinda old, you sure it isn't implemented in the newest apache?


Ahh yes, I actually went and contacted the developer who posted the patch..from what he said, I should be using the UserDir directive instead of regex to achieve ~username. And I should be able to compile in suPHP in owner mode. He also said SuExec is built into apache, by that I hope he means that the cgi-scripts will execute automatically as the user...if not thats not a big deal atm.

So wish me luck recompiling apache.

I appreciate the help you were able to yeild.
Related topics
req: PHP to list files in directory, and link to them
web-based project manager
Sun, Microsoft tout fruits of cooperation
PHP: Directory listing code
Web Based Game
Installing a SMF based forum
foobar or winamp?
Funny Pictures!
Uploader v6,Shoutbox,Simple Gallery,Simple Directory indexer
Guide on Formatting a Windows Based PC
Flash Based webchat (Instant Install & Integrate) [Free]
Flat file-based, MySQL-based counter
Free Links Directory - submit your site or favorite site
CrazyLeaf Design Web Directory and Forum
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.