运行 WHM 时如何以正确的方式添加虚拟主机?
我正在运行一台专用服务器,为我的客户使用 WHM 和 CentOS 5 分隔帐户。我的一个客户要求我安装 subversion,并将存储库存储在 webroot 下。
- 存储库的真实文件夹将位于“/home/theirfolder/svn”中,
- 存储库将通过“svn.theirdomain.com”上的子域访问
我知道执行此操作的常规方法是在 Apache 中设置一个虚拟主机来处理重定向。问题是 WHM 似乎超越了整个虚拟主机过程,迫使我将更改烘焙到似乎对我不起作用的外部文件中。当保留 webroot 下的文件夹时,我根本无法让虚拟主机识别该文件夹的路径。
我得到的最接近的结果是将 subversion 文件夹移动到 webroot 上,但即使如此,我使用身份验证的说明也没有得到遵循,所以从安全角度来看,这不是一个好的解决方案。在此设置中,页面似乎是由 Apache 而不是由 Subversion 生成的。
这里的任何人都可以为我指明可以指导我完成此类设置的教程的方向,或者为我提供关于我需要做什么的清晰的分步指南吗?我尝试了很多事情,但没有什么能真正让我到达那里。我已经正确下载并安装了 Subversion 及其所有依赖项。
提前致谢!
I'm running a dedicated server separating accounts for my clients with WHM and CentOS 5. One of my clients has asked me to install subversion, and have the repository stored beneath the webroot.
- repo's true folder will be in "/home/theirfolder/svn"
- repo will be accessed through a subdomain on "svn.theirdomain.com"
I know that the regular way to do this is to set up a virtual host in Apache that handles the redirect. The problem is that WHM seems to overtake the whole virtual hosting process, forcing me to bake changes into external files that don't even seem to work for me. When retaining the folder beneath the webroot, I could not get virtual hosting to recognize the path to this folder at all.
The closest I've gotten was instead moving the subversion folder onto the webroot, but even then, my instructions for using Authentication are not followed, so that's not a good solution, security-wise. It also appeared that in this setting pages were being generated by Apache and not by Subversion.
Can anyone here point me in the direction of a tutorial that can guide me through this type of setup, or give me a clear, step-by-step guide on what I need to do? I've tried a lot of things but nothing has really gotten me there. I already have Subversion and all of its dependencies downloaded and installed correctly.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实现此目的的一种方法是使用 之一WHM 的自定义包含文件,并以“常规方式”在其中添加自定义
指令。在这些文件中所做的更改将在 WHM 自动重建 Apache 配置文件时保留下来,而直接对 /etc/httpd/conf/httpd.conf 进行的任何更改可能不会。主 httpd.conf 在不同点
包含
三个自定义包含文件。这些文件(如果运行 Apache 2.x)位于:
之后指令您可以直接编辑这些文件,或通过 WHM 管理面板(服务配置 -> Apache 配置,包括编辑器,在 WHM 11.30 上)。
当 WHM/cpanel 无法通过其他配置方法执行我想要的操作时,我使用 post_virtualhost_2.conf 为客户帐户设置额外的虚拟主机。任何有效的 Apache 配置指令都可以放入该文件中 - 它只是完整地包含在主 httpd.conf 中。
One way to accomplish this is to use one of WHM's custom include files, and add your custom
<virtualhost>
directives there the "regular way". Changes made in these files will survive an automatic rebuild of the Apache configuration files by WHM, while any changes made directly to /etc/httpd/conf/httpd.conf might not.There are three custom include files that are
included
by the main httpd.conf at different points. These files (if running Apache 2.x) are located at:<virtualhost>
directives<virtualhost>
directivesYou can edit these files directly, or via the WHM admin panel (Service Configuration -> Apache Configuration, Include Editor, on WHM 11.30).
I've used post_virtualhost_2.conf to setup additional vhosts for client accounts when WHM/cpanel won't do what I want it to via other configuration methods. Any valid Apache configuration directives can go in the file - it's simply included in its entirety in the main httpd.conf.
上述说明并不是您针对每个帐户使用的说明。放置在 apache include 中的任何内容都是服务器范围的。
您可能希望使用 apache include 来包含 mod dav 和 mod authz 共享对象。您可能已经设置好了,但为了以防万一,这里有说明。
在 WHM 中,转到服务配置 -> Apache 配置 -> 包含编辑器
将其放置在 Pre Main Include 中:
接下来,您要创建一个 .conf 文件并将其放置在
如果您想要 SSL 中,请执行相同操作
如果上面的目录尚不存在,那么您将需要创建它们。
文件将包含:
用户名和密码可以设置为:
然后提交文件更改执行:
您应该能够浏览
并从中提取
The instructions above are not what you would use on a per account basis. Anything placed in the apache includes are server wide.
You would want to use the apache includes to include the mod dav and mod authz shared object. You probably already have it set but here are instructions just in case.
In WHM go to Service Configuration->Apache Configuration->Include Editor
Place this in the Pre Main Include:
Next you want to make a .conf file and place it in
If you want SSL do the same in
If the directories above are not already present then you will need to create them.
file would contain:
Username and password can be set with:
Then to commit file changes execute:
You should be able to browse to
and it will be pulling from