同时更新同一服务器上的数百个站点
我正在开发一个 Hostgator 专用服务器,其中有数百个站点,这些站点在文件结构和每个站点共有的 .php 文件方面具有相似性。
我希望能够仅在一个站点(“模型”站点)上工作,然后在所有其他站点之间同步这些更改。我愿意自动或半手动(运行脚本或命令)发生这种情况。一个要求是,由于一些站点不同,因此需要将它们从同步中排除。实现这一目标的一些技术?这是我到目前为止的想法...
RSync
:rsync 能够做到这一点吗?我 从未使用过它,但听说它是 非常适合将文件从一个服务器位置复制到另一个服务器位置。SSH
:我不太舒服 使用 shell 命令但我可以 想象这绝对是 制作这些的“适当”地方 种变化。 (不知道如何 循环并进行更改 目录(除了少数不同的目录)PHP
:如果可能的话我很乐意 能够使用 PHP 执行此操作,但我的服务器使用 SuPHP 来确保安全,并且我无法真正绕过它所需的权限。不过,我也许可以切换到 fcgi...(也接受这方面的建议)
我的文件结构如下:
/home/model/ /home/site1/ /home/site2/ /home/site3/ /home/exception/ /home/site5/ /home/site6/ /home/exception/
I'm working on a Hostgator dedicated server where there are hundreds of sites that have similarities in file structure and .php files common to each site.
I would like to be able to work on just one site (a "model" site) and then sync those changes across all the other sites. I am open to either having this happen automatically or semi-manually (running a script or command.) One requirement is that since a few sites are different they would need to be excluded from this sync. What are some techniques for achieving this? Here is what I have thought of so far...
RSync
: is rsync capable of this? I
have never used it but heard it is
great for copying files from one server location to another.SSH
: I am not super comfortable
working with shell commands but I can
imagine this is definitely the
"proper" place to be making these
kinds of changes. (not sure how to
loop and make changes though all
directories EXCEPT the few that are different)PHP
: If possible I'd love to be
able to do this with PHP except my server uses SuPHP for security and I can't really get around the permissions it requires. I may be able to switch to fcgi though... (open to suggestions for this also)
My file structure is as follows:
/home/model/ /home/site1/ /home/site2/ /home/site3/ /home/exception/ /home/site5/ /home/site6/ /home/exception/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Bash 命令更合适并且往往更容易,
这样就结合了
rysnc
和符号链接ln
简而言之,
它会软链接 site1,site2,site3 来模拟
什么是符号链接?
http://en.wikipedia.org/wiki/Symbolic_link
之后,您只需<强>rsync您对目录模型的更改,
并且更改将立即应用于 site1、site2、site3
(因为所有目录都是模型的符号链接)
至于site5,site6,因为有区别, scp鞋子更合脚。
Bash commands are more suitable and tends to be easier,
such has combine
rysnc
plus symbolic linksln
In nutshell,
so, it will soft-link site1,site2,site3 to model
what is symbolic link ?
http://en.wikipedia.org/wiki/Symbolic_link
After that, you just need to rsync your changes to directory model,
and changes will immediately apply to site1,site2,site3
(because all directories are symbolic link to model)
as for site5, site6, since is difference, scp fit the shoe better.