How to add virtual hosts in the right direction while running WHM?

I am running a dedicated server sharing accounts for my clients with WHM and CentOS 5. One of my clients asked me to install subversion and have a repository stored below webroot.

  • The repo true folder will be in the folder "/ home / theirfolder / svn"
  • The repo will be available through a subdomain on the page "svn.theirdomain.com"

I know that the usual way to do this is to set up a virtual host in Apache that handles the redirection. The problem is that WHM seems to have overtaken the whole shared hosting process, forcing me to bake changes to external files that don't even work for me. When saving a folder under webroot, I could not get a shared hosting to find out the path to this folder in general.

The closest I got was instead moving the subversion folder to webroot, but even then my instructions for using authentication are not followed, so this is not a good solution, safe. It also turned out that Apache, and not Subversion, were generated in this parameter of the page.

Can someone here show me the direction of the tutorial that can help me with this type of setup, or give me a clear, step-by-step guide on what I need to do? I tried a lot of things, but nothing really came to me. I already have Subversion and all its dependencies are downloaded and installed correctly.

Thanks in advance!

+4
source share
2 answers

One way to do this is to use one of the custom WHM include files and add your usual <virtualhost> directives in the "normal way" there. Changes made to these files will be saved after the automatic rebuilding of Apache configuration files using WHM, while any changes made directly to /etc/httpd/conf/httpd.conf may not work.

There are three custom include files that are included main httpd.conf at different points. These files (if running Apache 2.x) are located at:

  • /usr/local/apache/conf/includes/pre_virtualhost_2.conf , included before the automatically generated <virtualhost> directives
  • /usr/local/apache/conf/includes/post_virtualhost_2.conf , enabled after the automatically generated <virtualhost> directives
  • /usr/local/apache/conf/includes/pre_main_2.conf , included at the beginning of httpd.conf

You can edit these files directly or through the WHM admin panel (Service Configuration β†’ Apache Configuration, Enable Editor, on WHM 11.30).

I used post_virtualhost_2.conf to set additional vhosts for client accounts when WHM / cpanel will not do what I want using other configuration methods. Any valid Apache configuration directives can go to the file - it is simply fully included in the main httpd.conf.

+9
source

The above instructions are not intended for each account. Everything that is placed in apache includes a server. You would like to use apache include to enable the shared object mod dav and mod authz. You probably already installed it, but there are instructions just in case. In WHM, go to Service Configuration -> Apache Configuration -> Include Editor Put this in Pre Main Include:

 LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so 

Then you want to create a .conf file and put it in

 /usr/local/apache/conf/userdata/std/2/<user account name>/svn.conf 

If you want SSL to do the same in

 /usr/local/apache/conf/userdata/ssl/2/<user account name>/svn.conf 

If the above directories are not already present, you will need to create them.

File

will contain:

 <IfModule mod_dav_svn.c> <Location /svn> DAV svn SVNPath /home/<user account>/svn AuthType Basic AuthName "My Repo" AuthUserFile /etc/svn-auth-conf Require valid-user </Location> </IfModule> 

The username and password can be set using:

 htpasswd -cm /etc/svn-auth-conf myusername 

Then, to commit the changes to the file, do:

 /scripts/ensure_vhost_includes --user=<user account> /scripts/rebuildhttpdconf /scripts/restartsrv_httpd 

You should be able to browse

 yourdomain.com/svn 

and he will pull from

 /home/<user account>/svn 
+3
source

All Articles