LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-07-2004, 10:32 PM   #1
kodon
Member
 
Registered: Jul 2004
Location: [jax][fl][usa]
Distribution: Slackware64-current
Posts: 796

Rep: Reputation: 31
apache userdir subdomains


okay...running apache 1.3.31 as a test server right now(might open it up in the future)
i have added 'www.darkstar.net' as an alias to localhost in /etc/host
[* i went ahead and did this because i remember having problems with cookies and session information in xp using 'localhost' as server]
http://www.darkstar.net brings up the "it worked!" page in /var/www/htdocs

i have read that using userdirs can be dangerous. currently, my permissions are:
755 root:root /home
755 user1:root /home/user1
755 user1:root /home/user1/public_html

thinking perhaps these should be:
751 root:root /home
711 user1:root /home/user1
700 user1:root /home/user1/*
755 user1:root /home/user1/public_html

i did enable userdirs:
<IfModule mod_userdir.c>
UserDir disabled root
UserDir public_html
</IfModule>
#[what is the difference between 'UserDir public_html' and "UserDir /home/*/public_html'?]

and http://www.darkstar.net/~user1 brings up the index in /home/user1/public_html,
BUT i would like to set it up so that http://user1.darkstar.net will access /home/user1/public_html
...and i am not sure if AliasMatch, RewriteRule, or subdomains through VirtualHost would be the best way to achieve this. Does anyone know how production sites deal with this?
 
Old 08-08-2004, 01:30 AM   #2
Archite
Member
 
Registered: Jul 2004
Distribution: OpenBSD 3.5
Posts: 89

Rep: Reputation: 15
I might recomend virtualhosts. Then all you do is set up a new docs dir, and apache sends all requests for that name to that dir. Much easier and you don't have to screw w/ users home directory permissions. It appears though that you've block your apache user from gaining access to the home directory of the user. If apache can't go there, then it can't go to any subdirectory of that. I might just change the permissions to 750 and change the group of the home directories to that of apache. Personally though, I'd rather use virtualhosts...

Last edited by Archite; 08-08-2004 at 01:32 AM.
 
Old 08-08-2004, 03:22 AM   #3
kodon
Member
 
Registered: Jul 2004
Location: [jax][fl][usa]
Distribution: Slackware64-current
Posts: 796

Original Poster
Rep: Reputation: 31
i just ran across VirtualDocumentRoot in the docs [mod_vhost_alias]

looks promising
 
Old 08-08-2004, 03:25 AM   #4
Archite
Member
 
Registered: Jul 2004
Distribution: OpenBSD 3.5
Posts: 89

Rep: Reputation: 15
Hmmm, I've never used that, might be promising. Please keep me informed on your results
 
Old 08-08-2004, 04:40 AM   #5
kodon
Member
 
Registered: Jul 2004
Location: [jax][fl][usa]
Distribution: Slackware64-current
Posts: 796

Original Poster
Rep: Reputation: 31
UseCanonicalName Off

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.darkstar.net
VirtualDocumentRoot /home/%1/public_html
</VirtualHost>

---------------------------------------------------------

this is working right now for me...i probably will move everything to one folder (eg /usr/local/apache/htdocs/user) where i would just have to change the value of VirtualDocumentRoot.
however, i did have to put each site in the /etc/hosts file:

127.0.0.1 localhost
127.0.0.1 darkstar.localhost darkstar
127.0.0.1 www.darkstar.net
127.0.0.1 kodon.darkstar.net

is there any way to use a wildcard such as:
127.0.0.1 *.darkstar.net
 
Old 08-09-2004, 06:46 PM   #6
kodon
Member
 
Registered: Jul 2004
Location: [jax][fl][usa]
Distribution: Slackware64-current
Posts: 796

Original Poster
Rep: Reputation: 31
Quote:
Originally posted by Archite
It appears though that you've block your apache user from gaining access to the home directory of the user. If apache can't go there, then it can't go to any subdirectory of that.
the 700 was meant as files and directories other than public_html inside the user's home directory
 
Old 08-09-2004, 06:56 PM   #7
kodon
Member
 
Registered: Jul 2004
Location: [jax][fl][usa]
Distribution: Slackware64-current
Posts: 796

Original Poster
Rep: Reputation: 31
after minor tweaks (trial and error) i now have:
Code:
UseCanonicalName Off

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    ServerName www.darkstar.net
    DocumentRoot /var/www/htdocs
</VirtualHost>
<VirtualHost 127.0.0.1:80>
    ServerName darkstar.net
    ServerAlias *.darkstar.net
    VirtualDocumentRoot /home/%1/public_html
</VirtualHost>

Last edited by kodon; 08-09-2004 at 06:58 PM.
 
Old 08-09-2004, 07:16 PM   #8
Archite
Member
 
Registered: Jul 2004
Distribution: OpenBSD 3.5
Posts: 89

Rep: Reputation: 15
kondon,

Sorry about the error, I missed the * after the / in your permissions Looks good to me though:-D
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache UserDir ]SK[ Linux - Software 4 06-18-2005 12:10 PM
APACHE and Subdomains basketkase999 Linux - Software 18 05-21-2005 10:38 PM
Apache userdir. collen Linux - Networking 1 01-28-2005 12:24 PM
Apache UserDir Abbaddon Slackware 12 09-15-2004 11:28 AM
Apache and Subdomains, Help pzorn Linux - General 2 01-27-2004 07:00 PM


All times are GMT -5. The time now is 07:57 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration