迁移到新服务器:如何将一个目录映射到另一个目录 [英] Migrating to a new server: how to map one directory to another

查看:147
本文介绍了迁移到新服务器:如何将一个目录映射到另一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我不知道这是否可能,如果是的话,是否需要在Apache配置或PHP配置中完成
,但这里有:


我正在将我的Web服务器迁移到另一台机器。实际上,它是两台机器 - 一台用于Web服务器本身,另一台用作

用户主目录和MySQL的数据服务器。


用户的主目录将在NFS挂载时安装在Web服务器上。


现在,原始的,当前的配置在

/ home / *。有许多PHP脚本通过绝对路径引用此目录

,例如,使用如下行:


<?包括(QUOT; /home/webmaster/public_html/include/thing.inc"); ?>


但是,NFS挂载的主目录安装在/ webusers上。这个

是因为我为实际的本地用户目录保留了/ home。


有没有办法将呼叫映射到/ home到/ webusers实际上没有

更改这些绝对路径调用存在的所有地方?


请注意,来自/ home-> / webusers的符号链接不会因为/ home

是一个真实的现有本地目录。


系统详情:

旧服务器:Red Hat Linux 9,Apache 1.3.x,PHP 4.3.x,MySQL 3.23.x

新服务器:

web:RHEL 4,Apache 2.0。 x,PHP 4.3.x

数据:RHEL 4,MySQL 4.1.x



谢谢!


-

JDS | je*****@example.inva 盖子

| http://www.newtnotes.com

DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

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 | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

推荐答案

JDS写道:
大家好。我不知道这是否可能,如果是的话,是否需要在Apache配置或PHP配置中完成,但这里有:

我正在迁移我的网络服务器到另一台机器。实际上,它是两台机器 - 一台用于Web服务器本身,另一台用作用户主目录和MySQL的数据服务器。

用户家dirs将作为NFS挂载安装在Web服务器上。

现在,原始的,当前的配置在
/ home / *中有用户主目录。有许多PHP脚本通过绝对路径引用此目录
,例如,使用如下行:

<?包括(QUOT; /home/webmaster/public_html/include/thing.inc"); ?>

但是,NFS挂载的主目录安装在/ webusers上。这是因为我为实际的本地用户目录保留了/ home。

有没有办法可以将呼叫映射到/ home。到/ webusers没有实际更改所有这些绝对路径调用存在的地方?

请注意,/ home-> / webusers的符号链接不起作用,因为/ home
是一个真实的,现有的本地目录。
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.




我能想到的最快的解决方案是为所有用户制作符号链接

位于/ webusers到/ home,这样你就可以解决所有绝对路径的问题,而不需要修改任何东西。


例如:ln -s / webusers /网站管理员/家庭


当然,如果有两个用户拥有相同的

目录名,这将导致问题。

Best解决方案当然要修复那些硬编码路径,你可以运行

之类的东西:

perl -npe's / \ / home\ // \ / webusers \ // g'' - i *


每个public_html和子目录(确定有人擅长

写一个小脚本,你可以使用)。

// Aho



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


2005年11月4日星期五18:26:06 + 0100,J.O。 Aho写道:
On Fri, 04 Nov 2005 18:26:06 +0100, J.O. Aho wrote:
我能想到的最快的解决方案是为/ webusers / home中的所有用户创建符号链接,这样你就可以解决问题


例如:ln -s / webusers / webmaster / home
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




啊,的课程。我现在就试试这个。


关于这一点的事情并不适合我。 Can; t

我的手指还在上面。


谢谢!


-

JDS | je*****@example.inva 盖子

| http://www.newtnotes.com

DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/



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 | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/


JDS写道:
2005年11月4日星期五18:26:06 + 0100,JO Aho写道:
On Fri, 04 Nov 2005 18:26:06 +0100, J.O. Aho wrote:
我能想到的最快的解决方案是为/ webusers / home中的所有用户创建符号链接,这样你就可以解决问题


例如:ln -s / webusers / webmaster / home
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



啊,当然。我现在就试试这个。

关于这一点的事情并不适合我。可以;然后把手指放在它上面。



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.




可能是导出媒体上的用户john和导入的用户john

机器?



Could it be user john on the exported media and the user john on the importing
machine?


这篇关于迁移到新服务器:如何将一个目录映射到另一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆