PDA

View Full Version : New filesystem hierarchy...



port80
08-27-2006, 11:24 PM
I am accustomed to a webroot of $HOME/www [/home/$USER/www]. I think it is a more organised method and programmatically allows use of the $HOME and $USER variables rather than providing literal static pathnames.

I have just taken steps to try reordering my own filesystem hierarchy. Not something I suggest people try as I have no idea if this will cause problems yet. But I would be interested if anyone else has tried it and what their experiences have been and what problems they have encountered if any.

EDIT: It should be noted by anyone considering trying this that I do this fully accepting the very real possibility that this could render my account inoperable. That I have taken these steps with the understanding that it may become necessary to completely restore my account back to default loosing everything in the process. I am making my account a guinea pig here. Additionally, I made this fact clear to the Westhost sys admin who changed the sym link permissions. He made the changes, but was careful to explain the following: "Having done this, I would like to make it clear that if we have any problems managing your account in the future, we may have to undo some of these changes so that we can perform the necessary tasks. For example, we occasionally need to move accounts from one server to another for load balancing, upgrades, network changes, etc. If the move process or any other maintenance or account management process chokes on your
changes, we may have to make our own changes to complete our task."

This is what I have done ($USER is username)...


Made backup copies of sym links /home and /usr/local/apache/htdocs to /home.old and /usr/local/apache/htdocs.old
Requested that a WH admin change permissions from root:root to $USER:vuser on sym links /home and /usr/local/apache/htdocs and on directory /usr/home
Deleted sym link /home and created directory /home
Moved contents of /usr/home to /home
Deleted directory /usr/home and all contents
Created sym link /usr/home pointing it to /home
Made backup copy of sym link /home/$USER/www to /home/$USER/www.old
Deleted sym link /home/$USER/www
Created directory /home/$USER/www
Changed symlink /usr/local/apache/htdocs to point to /home/$USER/www
Created sym links for all WH specific management files and directories pointing from /home/$USER/www to /var/www/html

/home/$USER/www/fm -> /var/www/html/fm
/home/$USER/www/manager -> /var/www/html/manager
/home/$USER/www/manager.html -> /var/www/html/manager.html
/home/$USER/www/plugins -> /var/www/html/plugins
/home/$USER/www/pma -> /var/www/html/pma
/home/$USER/www/users -> /var/www/html/users
/home/$USER/www/vdsbackup -> /var/www/html/vdsbackup

Made backup copy of /etc/httpd/conf/httpd.conf to /etc/httpd/conf/httpd.conf.old
Changed contents /etc/httpd/conf/httpd.conf

Line 471:

From...

DocumentRoot /var/www/html

To...

#DocumentRoot /var/www/html
DocumentRoot /home/$USER/www
Line 496:

From...

<Directory "/var/www/html">

To...

#<Directory "/var/www/html">
<Directory "/home/$USER/www">

Restarted my VPS


I left the cgi-bin alone. Personally I have no use for it as I place my cgi's in whatever directories I feel are relevant to the function of the program. Plus it holds certain WH scripts that are part of the manager so I just left it alone.

Also, if I missed anything I'd be interested to know.
-Mike

jalal
08-28-2006, 09:35 AM
Just to mention, because it is a virtual server, the HOME variable changes at different stages in the login. i.e. when you first SSH in, $HOME is set to '/'. After you have been cleared, then HOME becomes '/home/username/'. How various applications see HOME depends on what sort of login they use...

To be more 'standard' then the users' HTML directory should be '/home/username/public_html' with '/home/username/www/' being a symlink to that.

Otherwise, go for it...

I just wish WH wouldn't clutter up the Document Root with all that other junk (manager, fm etc...).

port80
08-28-2006, 10:56 AM
I have not yet observed the behaviour of the $HOME variable you speak of yet, but I will test for it when I get the chance.

Agreed on the "more standard" public_html... but 2 reasons for not going that way. One being I just have never liked public_html as a name for a directory and www is easier to type, and two, sym links are not followed when navigating via ftp and mouse pointer clicks. Just as /usr/home is more standard, /home and /home/$USER/www are KISS (Keep It Simple Simon). :)

I also realized I did not check the settings of the SSH environment to see if it was set to /home/$USER or to /usr/home/$USER.

I can say that I have already observed that the WH control panel has recognised the new webroot path so it is nice to know the path is not a hardcoded static literal.

I have some other things in mind to look into, but it would be premature to mention them till I have a chance to investigate (and they are not a priorty to me).

Jalal, thanks for the heads up on $HOME. I'm still very new to WH and am glad to have your experience here to draw on. And as for clearing out that webroot, this has accomplished that, with the exception of the sym links which hopefully can easily be replaced by Alias directives in the httpd.conf file. I do not know how WH has the manager stuff coded yet so that is why I took the more cautious sym link approach to start. Tackling one set of potential errors at a time. So far it is working tho.

-Mike


Just to mention, because it is a virtual server, the HOME variable changes at different stages in the login. i.e. when you first SSH in, $HOME is set to '/'. After you have been cleared, then HOME becomes '/home/username/'. How various applications see HOME depends on what sort of login they use...

To be more 'standard' then the users' HTML directory should be '/home/username/public_html' with '/home/username/www/' being a symlink to that.

Otherwise, go for it...

I just wish WH wouldn't clutter up the Document Root with all that other junk (manager, fm etc...).