Reputation: 2908
Sigh... ok i've been at this for hours. Here's what i have:
Centos 6.3
WHM (cPanel) 11.34.1
Apache 2.2
Subversion + mod_dav_svn
If you're not aware, please note that WHM (cPanel) manages httpd.conf and WILL overwrite it when needed. There are inclusion .conf files we can use that get included at certain points during httpd.conf
Using an account "Website.com" I logged into it's cPanel and created a subdomain "server.website.com". The user location on the server is /home/websitecom and the subdomain location is /home/websitecom/server.
I have subversion repositories here: /svn/repos/rp1 etc. I am adding this into my conf
<Location /svn/repo1>
DAV svn
SVNPath /svn/repos/rp1
</Location>
Fantastic! works nice BUT, location /svn/repo1 is available on ALL hosts on the server since the <location>
directive is reading the REQUEST_URI server-wide.
All i want is to restrict the <location>
directive to the server.website.com domain...!!! Is this so hard?
In WHM I am using pre_virtualhost_global.conf
(gets included just before virtual host declarations) and I have tried:
<directory /home/websitecom/server>
<location /svn/repo1>
DAV svn
SVNPath /svn/repos/rp1
</location>
</directory>
I get "location is not allowed here"
I have tried:
<location /svn/repo1>
Require host server.website.com
DAV svn
SVNPath /svn/repos/rp1
</location>
I get couldn't perform authentication. AuthType not set!
I have tried
<virtualhost server.website.com:80>
<location /svn/repo1>
DAV svn
SVNPath /svn/repos/rp1
</location>
</virtualhost>
No warnings on service httpd restart
but it just doesnt work
Please let me know how to achieve <location>
specific to a host... what I am trying to achieve is something like:
<location /svn/repo1>
HOST www.example.com
</location>
Within a shared named host environment
UPDATE
I have also tried .htaccess:
<location /svn/repo1>
DAV svn
SVNPath /svn/repos/rp1
</location>
Error 500 Server Error "Location is not allowed here"
UPDATE
I have corrected Auth usage:
AuthType Basic
Require host server.website.com
AuthName "Repository Authentication"
AuthUserFile /svn/repos/rp1.htpasswd
Require valid-user
The password authentication works, but Require host server.website.com doesn't seem to be doing anything!?
Upvotes: 1
Views: 2040
Reputation: 2908
HA!!!
I found this in httpd.conf
# To customize this VirtualHost use an include file at the following location
Include "/usr/local/apache/conf/userdata/std/2/--USER--/--HOST--/*.conf"
So I created a file in "/usr/local/apache/conf/userdata/std/2/--USER--/--HOST--/svn.conf", contents:
<location /svn/repo1>
DAV svn
SVNPath /svn/repos/rp1
</location>
This solved this in the context of cPanel WHM, however on a basic centos apache server, I am still wondering if
<virtualhost server.website.com:80>
<location /svn/repo1>
DAV svn
SVNPath /svn/repos/rp1
</location>
</virtualhost>
Would still work !? Anyway, not an issue for me at the moment...
Upvotes: 0