LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-30-2004, 04:19 PM   #1
whysyn
Member
 
Registered: Jun 2003
Location: Cleveburg, OH
Distribution: mostly Fedora
Posts: 154

Rep: Reputation: 30
Apache with auto username hosts


Hello all,

I'd like to set up apache so that users automatically get their own virtual hostname, not just userdir.

I have DNS set up to return the server's IP for any hostname not otherwise configured.

What I need to do next is make apache behave as follows:

When it receives a request for "http://foo.site.com" to automatically use /home/foo/public_html/htdocs for document root and /home/foo/public_html/cgi-bin for a cgi alias.

Hopefully this can go into the apache config with some sort of wildcards so I don't have to manually configure every new user I add... I've tried using wildcards in a virtual hosts container but haven't had any luck.

Thanks!

~Eric

Last edited by whysyn; 12-30-2004 at 04:25 PM.
 
Old 12-30-2004, 04:36 PM   #2
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
mod_rewrite pratical solutions scroll down to the Virtual User Hosts section about a 1/3 the way down
 
Old 12-31-2004, 09:38 AM   #3
whysyn
Member
 
Registered: Jun 2003
Location: Cleveburg, OH
Distribution: mostly Fedora
Posts: 154

Original Poster
Rep: Reputation: 30
EDIT
The more I read the article linked, the less I think I understand it :-) The regex makes sense to me, but I'm not sure how to implement that sample into my httpd.conf file.
/EDIT

Great article, thank you. I'm not sure how I missed it while searching the apache site...

One more question:
I do have a couple of statically configured virtual hosts, how do I specify a seperate cgi-bin directory & seperate cgi-directory options to only apply to the userdir sites? If I put two ScriptAlias directives in the main configuration, won;t they interfere with eachother?

Thanks again!

~Eric

Last edited by whysyn; 12-31-2004 at 09:46 AM.
 
Old 12-31-2004, 10:53 AM   #4
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
if you read this article then it you will tell you that the context of RewriteCond and RewriteRule can be any of: server config, virtual host, directory, .htaccess.

I am looking into this myself because at the minute I use virtual hosts but I want to use userdirs and use rewrite rules to map the domains to the userdirs. So those rules under Virtual User Hosts of the pratical solutions article look very promising to me. As for the cgi directory I think something like this would do:
Code:
#taken from the default apache httpd.conf file
<Directory /home/*/public_html>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS PROPFIND>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS PROPFIND>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

# Allow each user to have dir to exec cgi scripts
<Directory "/home/*/public_html/cgi-bin">
    Options ExecCGI
    SetHandler cgi-script
</Directory>
As far as I am aware you can have as many scriptalias directives as you want as long as you use different names:
Code:
ScriptAlias /cgi-bin/ /home/user/cgi-bin/
ScriptAlias /cgi-shared/ /home/cgi-shared/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache hosts Henster Linux - Software 1 07-24-2005 05:24 AM
apache username tethysgods Linux - Software 6 07-08-2004 09:45 AM
apache virtual hosts Red Squirrel Linux - Software 4 06-20-2004 09:05 AM
Apache: making a dir with username and pwd fledermaus Linux - Networking 1 05-13-2004 09:40 AM
Apache Virtual Hosts gbg Linux - Software 4 10-02-2003 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration