如何将现有的 Apache 配置移动到另一台机器上?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1495996/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to move existing Apache configuration to another machine?
提问by Anandan
I have an Apache (httpd) up and running on one machine. Now I want to move configuration details to another machine. The other machine should have the appropriate changes like creating Apache home directories, shares created, etc.
我在一台机器上启动并运行了一个 Apache (httpd)。现在我想将配置细节移到另一台机器上。另一台机器应该进行适当的更改,例如创建 Apache 主目录、创建共享等。
I want to automate the above process. How do I do that?
我想自动化上述过程。我怎么做?
回答by Jeremy Stein
I don't know of any utility or script that will do that for you. There are probably too many variables depending on your configuration.
我不知道有任何实用程序或脚本可以为您做到这一点。根据您的配置,可能有太多变量。
Why do you want to automate the process? If it's because you expect to do it more than once, here's what I recommend you do:
为什么要使流程自动化?如果是因为您希望这样做不止一次,那么我建议您这样做:
- Copy all the files to the new machine with
scp. This should cover 95% of your configuration. - Perform any other configuration necessary, but do it all with the command line.
- Copy your history into a script and keep it handy for next time. It will probably require some tweaking to get it to run on its own.
- 将所有文件复制到新机器上
scp。这应该涵盖 95% 的配置。 - 执行任何其他必要的配置,但都使用命令行来完成。
- 将您的历史记录复制到脚本中,以便下次使用。它可能需要一些调整才能让它自己运行。
回答by Anandan
you can copy your httpd.conf and any other httpd access files, your content, move them to your new server in the corect places. make necessary configs like ip and ports and ... then restart apache.(note:your apache servers should have same version.)
您可以复制您的 httpd.conf 和任何其他 httpd 访问文件、您的内容,将它们移动到正确位置的新服务器上。进行必要的配置,如 ip 和端口,然后...然后重新启动 apache。(注意:您的 apache 服务器应该具有相同的版本。)
回答by slash
I would agree to Jeremy. I assume you are using UNIX. You would need to FTP whole apache folder from source server to destination server. something like ftp> mget *
我会同意杰里米。我假设您使用的是 UNIX。您需要将整个 apache 文件夹从源服务器 FTP 到目标服务器。类似于 ftp> mget *
And then you can start apache server on destination by running httpd.
然后你可以通过运行 httpd 在目标上启动 apache 服务器。

