利用SVNListParentPath增加http浏览仓库根目录的功能
2006-04-17 20:42
375 查看
使用SVNParentPath的时候,直接访问ParentPath的时候,总是得到以下错误提示:
403Forbidden
下面的办法可以搞定它:
一、首先,Subversion1.3及以后版本支持SVNListParentPathON,之前的版本只能使用PHP自己做。
二、Location设置中最后要加上/,应该是<Location/svn/>而不是<Location/svn>否则可能不能访问。
三、通过“http://localhost/svn/”来访问仓库列表,如果想让“http://localhost/svn”也起作用的话,需要在</Location>的后面增加重定向的设置:RedirectMatch^(/svn)$$1/ ,当然也可以采用RewriteEngine之类的办法。
四、修改后的httpd.conf的对应部分如下:
<Location/svn/>
DAVsvn
SVNListParentPathon
SVNParentPathe:/svn
# SSLRequireSSL #指定该目录只能通过SSL操作
# SVNPathAuthzoff
AuthzSVNAccessFilee:/ca/access/file
#tryanonymousaccessfirst,resorttoreal
#authenticationifnecessary.
#SatisfyAny
Requirevalid-user
#howtoauthenticateauser
AuthTypeBasic
AuthName"服务器需要身份验证:"
# AuthUserFilee:/ca/access/svn-auth-file
AuthMySQLHostlocalhost
AuthMySQLUserBugfree
AuthMySQLPasswordmandarin
AuthMySQLDBBugFree
AuthMySQLUserTableBugUser
AuthMySQLNameFieldUserName
AuthMySQLPasswordFieldUserPassword
# AuthMySQLMD5PasswordsOn
AuthMySQLPwEncryptionmd5
</Location>
RedirectMatch^(/svn)$$1/
五、如果使用Subversion1.3以前的版本,或需要定制列表显示的话,可以自己写php脚本来控制仓库列表的显示,TotoiseSVN的帮助文件中有详细描述:
Savethelinesabovetoafile
Uncomment(removethe'#'char)fromthefollowinglineinyourApacheconfigfile:
Addthefollowinglinesjustbelowyour<Location>blockwhereyoudefineyourSubversionstuff:
1、Alias:重写到本地路径
可以使用Alias把一个指定的Url重写到某一固定的本地路径
Alias/test//home/www/test/
那么对http://..../test/将对应了/home/www/test/
注意:Alias必须是一一对应的,/test/将不对/test起作用。
2、AliasMatch:重写到本地路径
与Alias类似,但是可以使用正则表达式
AliasMatch^/test(.*)/home/www/test$1
3、Redirect:重写到网址
Redirect/test/http://....../test2/
4、RedirectMatch:重写到网址
与Redirect类似,但是可以使用正则表达式
Redirect/test(.*)http://....../test2$1
在不需要很复杂的URL重写时,完全可以使用以上的几条指令来进行。
403Forbidden
Forbidden
Youdon'thavepermissiontoaccess/svn/onthisserver.下面的办法可以搞定它:
一、首先,Subversion1.3及以后版本支持SVNListParentPathON,之前的版本只能使用PHP自己做。
二、Location设置中最后要加上/,应该是<Location/svn/>而不是<Location/svn>否则可能不能访问。
三、通过“http://localhost/svn/”来访问仓库列表,如果想让“http://localhost/svn”也起作用的话,需要在</Location>的后面增加重定向的设置:RedirectMatch^(/svn)$$1/ ,当然也可以采用RewriteEngine之类的办法。
四、修改后的httpd.conf的对应部分如下:
<Location/svn/>
DAVsvn
SVNListParentPathon
SVNParentPathe:/svn
# SSLRequireSSL #指定该目录只能通过SSL操作
# SVNPathAuthzoff
AuthzSVNAccessFilee:/ca/access/file
#tryanonymousaccessfirst,resorttoreal
#authenticationifnecessary.
#SatisfyAny
Requirevalid-user
#howtoauthenticateauser
AuthTypeBasic
AuthName"服务器需要身份验证:"
# AuthUserFilee:/ca/access/svn-auth-file
AuthMySQLHostlocalhost
AuthMySQLUserBugfree
AuthMySQLPasswordmandarin
AuthMySQLDBBugFree
AuthMySQLUserTableBugUser
AuthMySQLNameFieldUserName
AuthMySQLPasswordFieldUserPassword
# AuthMySQLMD5PasswordsOn
AuthMySQLPwEncryptionmd5
</Location>
RedirectMatch^(/svn)$$1/
五、如果使用Subversion1.3以前的版本,或需要定制列表显示的话,可以自己写php脚本来控制仓库列表的显示,TotoiseSVN的帮助文件中有详细描述:
Savethelinesabovetoafile
svn_index.phpandstorethatfileinyourwebrootfolder.NextyouhavetotellApachetoshowthatpageinsteadoftheerror:
Uncomment(removethe'#'char)fromthefollowinglineinyourApacheconfigfile:
Addthefollowinglinesjustbelowyour<Location>blockwhereyoudefineyourSubversionstuff:
六、URL重写的若干非mod_rewrite方法
原文出处:http://www.chinaunix.net作者:HonestQiao 发表于:2005-09-2323:40:16
1、Alias:重写到本地路径
可以使用Alias把一个指定的Url重写到某一固定的本地路径
Alias/test//home/www/test/
那么对http://..../test/将对应了/home/www/test/
注意:Alias必须是一一对应的,/test/将不对/test起作用。
2、AliasMatch:重写到本地路径
与Alias类似,但是可以使用正则表达式
AliasMatch^/test(.*)/home/www/test$1
3、Redirect:重写到网址
Redirect/test/
4、RedirectMatch:重写到网址
与Redirect类似,但是可以使用正则表达式
Redirect/test(.*)
在不需要很复杂的URL重写时,完全可以使用以上的几条指令来进行。
相关文章推荐
- 利用SVNListParentPath增加http浏览仓库根目录的功能
- 利用SVNListParentPath增加http浏览仓库根目录的功能
- 利用SVNListParentPath增加http浏览仓库根目录的功能
- 设置SVNListParentPath后浏览出现Forbidden
- SVNListParentPath on配置以及在根目录显示项目列表
- JS间隔性滚动代码[修正增加了部分功能] 【转:http://www.cnblogs.com/robot/archive/2008/04/09/1144568.html】
- 给文件右击菜单增加7-ZIP浏览功能(用注册表设置Shell调用预览命令)
- Groovy应用:利用GFreeMarker为FreeMarker模板增加插件功能
- 利用HttpSessionListener实现网站在线人数统计功能[摘]
- 利用lucene给网站、系统增加搜索功能
- 利用flexpaper开发类似百度文库功能,在线浏览WORD文档
- 三维浏览共享 http://211.144.119.140/viewer/v1/?path=507bdc8bfde503996e00000b.mrf&view=3
- DC.Web.HttpCompress 压缩模块发布(采用原作者最新版,修复2处Bug,增加缓存功能)!(更新源码)
- 利用LoadRunner进行http接口功能自…
- 为VisualSVN Server增加在线修改用户密码的功能
- duilib 给List表头增加百分比控制宽度的功能
- svn利用钩子脚本功能实现代码同步到web目录
- 在chrome中利用“油猴”为每个网页增加“返回顶部”功能
- 给自己的程序增加网页浏览功能
- 利用nginx的http转发功能做内网yum源