 |
|
 |
|
|
 |
Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-04-05 10:55 PM
Hi all. I don't know if this is possible, and if it is, whether it needs
to be done within Apache configuration or php configuration, but here goes:
I am migrating my web server to another machine. In fact, it is two
machines -- one for the web server itself, and one as a data server for
user home directories and MySQL.
The users' home dirs will be mounted on the web server as NFS mounts.
Now, the original, current, configuration has user home directories in
/home/*. There are a number of php scripts that refer to this directory
by an absolute path, for example, with lines like:
<? include("/home/webmaster/public_html/include/thing.inc"); ?>
However, the NFS mounted home directories are mounted on /webusers. This
is because I was reserving /home for actual local user directories.
Is there a way I can map calls to "/home" to "/webusers" without actually
changing all of the places that such absolute-path calls exist?
Note that a symbolic link from /home->/webusers wil not work because /home
is a real, existing, local directory.
System details:
old server: Red Hat Linux 9, Apache 1.3.x, php 4.3.x, mysql 3.23.x
new server(s):
web: RHEL 4, Apache 2.0.x, php 4.3.x
data: RHEL 4, mysql 4.1.x
I can post any more details as requested, of course.
Thanks!
--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-04-05 10:55 PM
JDS wrote:
> Hi all. I don't know if this is possible, and if it is, whether it needs
> to be done within Apache configuration or php configuration, but here goes
:
>
> I am migrating my web server to another machine. In fact, it is two
> machines -- one for the web server itself, and one as a data server for
> user home directories and MySQL.
>
> The users' home dirs will be mounted on the web server as NFS mounts.
>
> Now, the original, current, configuration has user home directories in
> /home/*. There are a number of php scripts that refer to this directory
> by an absolute path, for example, with lines like:
>
> <? include("/home/webmaster/public_html/include/thing.inc"); ?>
>
> However, the NFS mounted home directories are mounted on /webusers. This
> is because I was reserving /home for actual local user directories.
>
> Is there a way I can map calls to "/home" to "/webusers" without actually
> changing all of the places that such absolute-path calls exist?
>
> Note that a symbolic link from /home->/webusers wil not work because /home
> is a real, existing, local directory.
The fastest solution I can think of would be to make symlinks for all users
located in /webusers to /home, this way you would get around the problem of
all absolute paths without modifying anything.
eg: ln -s /webusers/webmaster /home
of course this will lead to problems if there are two users with the same
directory name.
Best solution would of course to fix those hard coded paths, you could run
something like:
perl -npe 's/\/home\//\/webusers\//g' -i *
on each public_html and the subdirectories (sure there are people good at
writing a small script that you could use).
//Aho
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-04-05 10:55 PM
On Fri, 04 Nov 2005 18:26:06 +0100, J.O. Aho wrote:
> The fastest solution I can think of would be to make symlinks for all user
s
> located in /webusers to /home, this way you would get around the problem o
f
> all absolute paths without modifying anything.
>
> eg: ln -s /webusers/webmaster /home
Ah, of course. I'll try this for now.
something about this is not sitting quite right with me, though. Can;t
put my finger on it yet.
Thanks!
--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-04-05 10:55 PM
JDS wrote:
> On Fri, 04 Nov 2005 18:26:06 +0100, J.O. Aho wrote:
>
>
> Ah, of course. I'll try this for now.
>
> something about this is not sitting quite right with me, though. Can;t
> put my finger on it yet.
Could it be user john on the exported media and the user john on the importi
ng
machine?
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-04-05 10:55 PM
JDS wrote:
> Hi all. I don't know if this is possible, and if it is, whether it needs
> to be done within Apache configuration or php configuration, but here goes
:
>
> I am migrating my web server to another machine. In fact, it is two
> machines -- one for the web server itself, and one as a data server for
> user home directories and MySQL.
>
> The users' home dirs will be mounted on the web server as NFS mounts.
>
> Now, the original, current, configuration has user home directories in
> /home/*. There are a number of php scripts that refer to this directory
> by an absolute path, for example, with lines like:
>
> <? include("/home/webmaster/public_html/include/thing.inc"); ?>
>
> However, the NFS mounted home directories are mounted on /webusers. This
> is because I was reserving /home for actual local user directories.
>
> Is there a way I can map calls to "/home" to "/webusers" without actually
> changing all of the places that such absolute-path calls exist?
>
> Note that a symbolic link from /home->/webusers wil not work because /home
> is a real, existing, local directory.
>
> System details:
> old server: Red Hat Linux 9, Apache 1.3.x, php 4.3.x, mysql 3.23.x
>
> new server(s):
> web: RHEL 4, Apache 2.0.x, php 4.3.x
> data: RHEL 4, mysql 4.1.x
>
> I can post any more details as requested, of course.
>
> Thanks!
>
First of all, you should be using:
include ($_SERVER['DOCUMENT_ROOT']) . '/include/thing.inc');
Then if you change to another server or otherwise move your Apache
document_root you don't need to change all of your include statements.
As for the rest of the question, there's no way I can think of. And
Apache alias for the directory would not affect php include statements.
Since you can't create the symlink I think you're stuck with changing
all of your include statements.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-04-05 10:55 PM
On Fri, 04 Nov 2005 14:40:45 -0500, Jerry Stuckle wrote:
> First of all, you should be using:
>
> include ($_SERVER['DOCUMENT_ROOT']) . '/include/thing.inc');
>
> Then if you change to another server or otherwise move your Apache
> document_root you don't need to change all of your include statements.
>
> As for the rest of the question, there's no way I can think of. And
> Apache alias for the directory would not affect php include statements.
>
> Since you can't create the symlink I think you're stuck with changing
> all of your include statements.
Thanks. "Should be" is not really possible because this machine has
scripts written over the past five years, by several different
individuals, with extremely loose enforcement of coding style. Too late
to change that.
Here is what I did:
* symlinks to each user in /webusers to /home (as suggested by Aho)
* am enforcing a policy whereby local users home directories are called
"/home/username-local" so that there is no name squashing going on by
mistake
shouldn't matter too much -- there are not going to be more than one or
two local user on the apache box anyways. user data is all on the data box.
Thanks for any and al help, o' Usenet denizens.
--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-04-05 10:55 PM
JDS wrote:
[vbcol=seagreen]
> shouldn't matter too much -- there are not going to be more than one or
> two local user on the apache box anyways. user data is all on the data box.[/vbcol
]
If there is only a couple of local users, then maybe it had been easier to d
o
the other way around, having the local users say in /users and mount the nfs
export to /home.
//Aho
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-08-05 11:20 PM
On Sat, 05 Nov 2005 00:07:09 +0100, J.O. Aho wrote:
> If there is only a couple of local users, then maybe it had been easier to
do
> the other way around, having the local users say in /users and mount the n
fs
> export to /home.
Yes, I had considered this.
Well, the thing ain't fully configured and certainly isn't live yet, so I
just may do this.
I wonder if there is a way to make "/whatever_directory" the default
home directory for users created with "useradd". I'll have to look into
this...
--
JDS | jeffrey@go.away.com
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
11-08-05 11:20 PM
>> If there is only a couple of local users, then maybe it had been easier to do
>
>Yes, I had considered this.
>
>Well, the thing ain't fully configured and certainly isn't live yet, so I
>just may do this.
>
>I wonder if there is a way to make "/whatever_directory" the default
>home directory for users created with "useradd". I'll have to look into
>this...
On at least some flavor of Linux, the -D option can be used to
change the defaults (permanently) for various things like home
directory, shell, and group. This information seems to be kept in
/etc/login.defs.
Gordon L. Burditt
[ Post a follow-up to this message ]
|
|
|
 |
|
|
|
 |
Re: Migrating to a new server: how to map one directory to another |
 |
 |
|
|
|
|
|
Sponsored Links |
 |
 |
|
|
 |
All times are GMT. The time now is 03:03 PM. |
 |
|
|
 |
|
 |
|
|
 |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
|
|
|
|
Medical and Health forum | Computer Games Reviews | Graphics design forum
|
 |
|
 |
|