如何通过apache mod qos

使用mod_dav_svn访问Subversion仓库
使用mod_dav_svn访问Subversion仓库
来源:linuxing 来源:linuxfly.org
在前面的日志中,讲述了如何使用Subversion提供的svnserve服务,通过svn://协议访问远端的仓库数据。实际上,Subversion的设计包括了一个抽象的网络层,这意味着版本库是可以通过各种服务器进程访问的。理论上来会说,Subversion可以使用无限数量的网络协议来实现,甚至可以直接用perl利用相关的接口来编写自定义协议。但日常中,用得最多的就是svn://协议,和用mod_dav_svn模块通过Apache服务进行访问。
通过HTTP协议访问版本库是Subversion的亮点之一,这种方式具备许多svnserve服务器所没有的特性,使用上更加灵活。
一、关于mod_dav_svn模块
由于Subversion需要版本化的控制,因此标准的HTTP协议不能满足需求。要让Apache与Subversion协同工作,就要使用WebDAV(Web-based
Distributed Authoring and Versiong)Web分布式创作和版本控制协议。WebDAV是HTTP
1.1的扩展,关于WebDAV的规范和工作原理,可以参考。
mod_dav_san模块就是作为Subversion与Apache之间的接口,通过它,Apache就可以访问版本库,并且可以让客户端也使用HTTP的扩展协议WebDAV/DeltaV进行访问。
二、安装和配置
与单纯的svnserve不同,要通过Apache访问Subversion,除了必须已经部署好Apache和Subversion的基本环境外,当然不可缺少的是mod_dav_svn模块了:
# rpm -qa|grep svn
mod_dav_svn-1.4.2-2.1AX
2、创建版本仓库
这与以前的工作是基本相同的,不同点在于,需要让运行Apache的用户拥有该仓库的所有权:
# mkdir /var/www/svn
# cd /var/www/svn/
# svnadmin create stuff
# chown -R apache.apache stuff/
这样,就创建了一个stuff仓库,并让apache称为该仓库宿主。
3、修改Apache配置
需要激活Apache加载mod_dav_svn模块。
修改/etc/httpd/conf.d/subversion.conf配置文件的内容为:
# 加载相应的模块
LoadModule dav_svn_module&&&&
modules/mod_dav_svn.so
LoadModule authz_svn_module&& modules/mod_authz_svn.so
&Location /repos&
&& DAV svn
&& SVNPath /var/www/svn/stuff
&/Location&
重新启动httpd服务后,通过浏览器访问http://ip/repos,即可看到如下界面:
4、加入认证信息
上面定义的版本仓库,默认是任何人都可以匿名访问,并且拥有完全的写入、读取、修改、提交、删除版本库中信息的权限。
因此,我们需要加入认证信息以做权限的管理。HTTP协议版本就提供了简单的客户端认证方式,这可通过Apache配置完成。
Apache提供了一个htpasswd工具来管理,使用该工具可以创建一个文件,其中存放着用户名和加密后的密码信息。而这些就是Subversion可以引用的用户了,根据这些用户信息,配合mod_authz_svn模块即可进行目录的访问控制。
a、创建存放用户名信息的文件
用htpasswd命令创建文件:
# mkdir /etc/svn
# htpasswd -c /etc/svn/svnusers.conf linuxing
New password:
Re-type new password:
Adding password for user linuxing
还可以利用htpasswd添加用户,或修改密码,删除用户名等:
# htpasswd -m /etc/svn/svnusers.conf
NewUserName
# htpasswd -m /etc/svn/svnusers.conf OldUserName
# htpasswd -D /etc/svn/svnusers.conf OldUserName
-m 是可选的参数,当用-c创建用户名信息文件后,即可修改或添加用户信息。
b、修改/etc/httpd/conf.d/subversion.conf配置文件
在配置文件的Location标签部分,加入:
# 除了下面的动作需要认证外,其他动作不需验证
&LimitExcept GET PROPFIND OPTIONS REPORT&
&&AuthType Basic # 使用基本认证方式,即用户名、密码认证
&&AuthName &Authorization Realm&
# 在认证对话框中出现的提示信息
&&AuthUserFile /etc/svn/svnusers.conf #
指定上面创建好的存放用户名信息的文件路径
&&Require valid-user # 限定只有用户输入正确的用户名和密码后才能访问该标签所指向的路径
&/LimitExcept&
该标签定义了,当进行除了指定的若干动作需要进行用户名和密码的认证后才能进行外,其他的动作是不做限制的。例如:只有认证用户可以写操作,同时也允许匿名的读取操作。
也可以使用&Limit &标签对特定的动作进行认证控制,甚至完全不用&Limit &或&LimitExcept
&标签,表示对所有的动作进行控制。此外,定义“Require linuxing hanry”的写法,可实现将只有用户信息文件中特定的linuxing和hanry用户才能通过认证。
重启httpd服务后,可使用浏览器或svn客户端对该认证工作进行验证。
验证失败,会提示:
5、进行目录访问控制
上面配置只能对Location标签内的路径执行某些动作时进行控制,若希望控制版本仓库中目录访问权限,需要利用mod_authz_svn模块。在上面的subversion.conf中,我们已经激活了该模块。
所以,接下来要做的,就是在Location标签中使用authz功能:
AuthzSVNAccessFile /etc/svn/accesspolicy.conf
其中,AuthzSVNAccessFile 指向的就是svnserve服务时使用的权限配置文件。每一段命名一个版本库和里面的路径,使用“认证用户(组)=权限”的方式描述每个用户(组)访问版本库的级别:r
是只读,rw是可读写,留空是不允许访问。另外,*表示所有用户,可以用于控制匿名用户的访问权限;@表示已经被分组的组名。
# cat /etc/svn/accesspolicy.conf
committers = paul,linuxing
developers = linuxing,hanry
* = r # 用于控制匿名用户的
@committers = rw
@developers = rw
[/private]
@comitters = r
这里定义了两个组,并对版本库中的特定路径给予了访问权限的控制。
加入AuthzSVNAccessFile选项后,需要重启httpd服务以让其生效。但权限控制文件的内容修改后马上生效,是不需重启httpd服务。
※ 更详细的说明,还可参考前面的日志:[原]使用Subversion的svn协议访问
三、注意事项
1、如果你有多个版本仓库,怎么办?
这时,可以使用多个Location,通过SVNPath来分别指定其路径;或者,参考配置文件中提供的,用SVNParentPath指定一个总路径,例如:
SVNParentPath /var/www/svn
但是,你务必需要给该总路径适当的宿主权限:
# chown -R apache.apache /var/www/svn
否则,访问时会提示权限不足的错误。接着,你就可以使用浏览器访问http://ip/repos/stuff等每个单独的版本库了。(每个单独的版本库,其Revision信息是独立的)
还需要留意两点:
a、虽然使用SVNParentPath指定了总路径,而且用浏览器去访问http://ip/repos可能会看到一些浏览信息。但如果总路径并没有加入到版本仓库中管理(即没有.svn目录下的文件),则通过svn客户端去访问版本仓库时,应通过实际仓库的路径去访问,如:http://ip/repos/stuff
b、使用mod_dav_svn模块,通过Apache访问版本仓库,是不需要启动svnserve服务的,一切都已经由dav模块做接口完成数据请求的工作,通过svn客户端以HTTP协议访问版本仓库即可。
2、能否通过一个权限配置文件对每个版本库进行访问权限?
Subversion提供版本库分支管理功能。因此,在svnserve服务,或使用mod_dav_svn模块,使用Apache访问Subversion版本库时,当定义权限配置文件中,是可以对每个版本库进行权限控制的。
以mod_dav_svn方式为例,像上面提到的SVNParentPath来指定版本库的总路径,如:
SVNParentPath = /var/www/svn
而实际上,真正的版本库是/var/www/svn下面的一些子目录,例如/var/www/svn/project1、/var/www/svn/project2,它们才是由svnadmin
create创建的版本仓库。
这时,可以在权限配置文件中,使用[repository:/path]的方式定义权限:
[project1:/]
@project1_committer =rw
[project2:/]
@project2_committer =rw
3、Apache与svn权限控制该用哪个?
根据上面的描述,可以在Apache中使用&Limit&等标签进行权限控制,也可以激活mod_authz_svn模块后,使用svnauthz格式的权限文件来控制。那该如何选择呢?
事实上,它们的区别在于权限的管理者不同,对于浏览器或svn客户端来说,除了Linux文件系统本身的访问权限外,&Limit&方式是让Apache根据发送的命令进行访问管理,svnauthz则是由mod_authz_svn来进行,它们没有本质的区别,都可以用。
但由于对命令的控制比较复杂,而且容易导致误操作,因此,我更建议使用svnauthz的方式管理访问权限:
&Location /repos&
&& DAV svn
&& SVNParentPath /var/www/svn
&& Satisfy Any
&& AuthType Basic
&& AuthName &Authorization Realm&
&& AuthUserFile /etc/svn/svnusers.conf
&& Require valid-user
&& AuthzSVNAccessFile /etc/svn/accesspolicy.conf
&/Location&
这里的/etc/httpd/conf.d/subversion.conf文件中,不需要加入&Limit&或&LimitExcept&标签。但加入了Satisfy
Any的设置,其表示在同时启用了Allow(允许)和Require的情况下,指定相关策略的,一共有两个备选值,All表示用户必须同时满足Allow和Require的条件,而Any则是满足其中之一即可。
这这里,Satisfy Any用于允许先用匿名方式尝试访问,并根据svnauthz对匿名用户的控制给予访问权限。若没有这句话,则无论svnauthz中是否加入了“*=r”的写法,匿名用户都是无法访问的。
4、svn协议与mod_authz_svn模块
svn协议,用于客户端使用svn://方式访问版本库,而mod_authz_svn模块让客户端可通过Apache访问版本库,它们分别使用不同的服务:svnserve、httpd进行访问。由于用户、组权限不同,权限管理方式也不相同,因此,不建议同时启动两种访问方式。
而易用性,管理方便的角度来分析,Apache以mod_authz_svn模块的方式访问版本库会更多人选择。(mod_authz_svn方式,使用80端口访问,并且提供https等加密传输,用于用户信息验证的密码保存方式不是明文的)
火龙果软件/UML软件工程组织致力于提高您的软件工程实践能力,我们不断地吸取业界的宝贵经验,向您提供经过数百家企业验证的有效的工程技术实践经验,同时关注最新的理论进展,帮助您“领跑您所在行业的软件世界”。Short Cuts
The Apache Software Foundation
Sister Sites
mod_perl2 User's Guide
By , Jim Brandt
Practical mod_perl
By , Eric Cholet
The mod_perl Developer's Cookbook
By Geoffrey Young, Paul Lindner, Randy Kobes
mod_perl Pocket Reference
By Andrew Ford
Writing Apache Modules with Perl and C
By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason
By Dave Rolsky, Ken Williams
mod_perl brings together the full power of the
programming language and the
HTTP server.
You can use
Perl to manage Apache, respond to requests for web
pages and much more.
mod_perl& is more than CGI scripting
on steroids.
It is a whole new way to create dynamic content by
utilizing the full power of the Apache web server to create stateful
sessions, customized user authentication systems, smart proxies and
much more.
Yet, magically, your old CGI scripts will continue to work
and work very fast indeed.
With mod_perl you give up nothing and gain
-- Lincoln Stein
mod_perl gives you a persistent Perl interpreter embedded in your web
This lets you avoid the overhead of starting an external
interpreter and avoids the penalty of Perl start-up time, giving you
super-fast dynamic content.
As you'd expect from the Perl community, there are hundreds of
modules written for mod_perl, everything from persistent
database connections, to templating systems, to complete
XML content delivery systems.
Web sites like
use mod_perl.
mod_perl is an
project. It is licensed under .
The mod_perl Web Site
mod_perl is the power behind many of the Internet's busiest and most
advanced web sites.
Listed here are success stories from people using
mod_ also, world-wide statistics of mod_perl usage
Get source and binary mod_perl distributions and download the documentation
The mod_perl project features a lot of documentation, both for
mod_perl 1.0 and 2.0. If there is anything you need to learn about
mod_perl, you'll learn it here.
Before a bug can be solved, developers need to be able to reproduce
it. Users need to provide all the relevant information that may assist
in reproducing the bug. However it's hard to know what information
needs to be supplied in the bug report. In order to speed up the
information retrieval process, we wrote the guidelines explaining
exactly what information is expected. Usually, the better the bug
report is the sooner it's going to be reproduced and therefore fixed.
Solve your mod_perl problems: with the help of the mod_perl mailing
lists, a mod_perl training company or a commercial support
company. Find an ISP providing mod_perl services.
mod_perl and related projects' mailing lists.
There is a lot of software out there ready to run with mod_perl and/or
help you with your programming project.
How to contribute to the mod_perl community
Advocacy documents and resources for mod_perl
General information regarding mod_perl of historical interest.
Other projects maintained under the mod_perl umbrella
Find the mod_perl job of your dreams!
You can reach any document on this site from this sitemap.
Have comments? Please send them to当前位置:&>&&>&&>&
apache mod_rewrite重写模块开启方法
发布时间:编辑:
本文介绍了如何开启apache mod_rewrite模块的方法,mod_rewrite用于url重写、伪静态等,有需要的朋友参考下。
本节内容:
在中,启用mod_rewrite模块。
操作步骤:
1,在conf目录的httpd.conf文件中找到
loadmodule rewrite_module modules/mod_rewrite.so
将这一行前面的#去掉。
2,在要支持url rewirte的目录启用 options followsymlinks和allowoverride all
复制代码 代码示例:
/php &c:/web/php/&
&directory &c:/web/php/&&
options indexes followsymlinks
allowoverride all
order allow,deny
allow from all
&/directory&
这样通过http://localhost:8080/php/访问时,/php/和其下面的子目录将支持url rewrite。
很多文章并没有提到要使用 options followsymlinks,因为在httpd.conf中有
复制代码 代码示例:
&directory /&
options followsymlinks
allowoverride none
order deny,allow
deny from all
satisfy all
&/directory&
这样如果网站配置成通过http://localhost:8080/来访问,就不会注意到options followsymlinks的影响,只需要将allowoverride none改为allowoverride all即可。
而我习惯于在本机配置成http://localhost:8080/php/,忘了加options indexes followsymlinks就成功不了,会显示
you don't have permission to access /php/f2blog/ on this server.
这样的错误。
在文档中找到了原因:
note: to enable the rewriting engine for per-directory configuration files you need to set ``rewriteengine on'' in these files and ``options followsymlinks'' must be enabled. if your administrator has
override of followsymlinks for a user's directory, then you cannot use the rewriting engine. this restriction is needed for security reasons.
实际上mod_rewrite是针对目录的,因此并不需要将httpd.conf中的所有allowoverride none改为allowoverride all,options也一样。
备注:5.0.28的文档我几乎都看了,也没有看到说到底能不能通过service.bat在windows上安装成功服务。
倒是看到n多人和我一样的疑问却没有答案。
不过,通过tomcatxx.exe能安装成功tomcat服务。
与 apache mod_rewrite重写模块开启方法 有关的文章
本文标题:
本页链接:
12345678910
12345678910怎样在Apache上安装MOD_SSL
出处:奥索网&
作者:sustomer&
责任编辑:zwg&
怎样在Apache上安装MOD_SSL
手工签署证书的方法
虽然在安装MOD_SSL时已经使用 make certificate 命令建立了服务器
的证书签名,但是有时你可能需要改变它。
当然有很多自动的脚本可以实现它,但是最可靠的方法是手工签署
首先我假定你已经安装好了openssl和MOD_SSL,如果你的openssl安装时
的prefix设置为/usr/local/openssl,那么把/usr/local/openssl/bin加入
执行文件查找路径。还需要MOD_SSL源代码中的一个脚本,它在MOD_SSL的
源代码目录树下的pkg.contrib目录中,文件名为 sign.sh。
将它拷贝到 /usr/local/openssl/bin 中。
先建立一个 CA 的证书,
首先为 CA 创建一个 RSA 私用密钥,
openssl genrsa -des3 -out ca.key 1024
系统提示输入 PEM pass phrase,也就是密码,输入后牢记它。
生成 ca.key 文件,将文件属性改为400,并放在安全的地方。
chmod 400 ca.key
你可以用下列命令查看它的内容,
openssl rsa -noout -text -in ca.key
利用 CA 的 RSA 密钥创建一个自签署的 CA 证书(X.509结构)
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt
然后需要输入下列信息:
Country Name: cn 两个字母的国家代号
State or Province Name: An Hui 省份名称
Locality Name: Bengbu 城市名称
Organization Name: Family Network 公司名称
Organizational Unit Name: Home 部门名称
Common Name: Chen Yang 你的姓名
Email Address:
生成 ca.crt 文件,将文件属性改为400,并放在安全的地方。
chmod 400 ca.crt
你可以用下列命令查看它的内容,
openssl x509 -noout -text -in ca.crt
键盘也能翻页,试试“← →”键
15.8美元约¥105
70.35元包邮
99元包邮(合44.5元/件)
148.9元包邮
87元(2件75折后)
软件论坛帖子排行
相关软件:查看: 2913|回复: 14
如何判断apache是否安装了mod_rewrite?
现在我搭建好了环境,也启用了静态页面配置,但是实际中,在前台打开信息页面时都是无法显示!
我是新手,也不知道自己的apache是否安装了mod_rewrite,麻烦高手指点下,不胜感激!
对于网上说的“重新编译apache”,但对这个专业术语实在不知道怎么重新编译,麻烦赐教!
请问我的apache中的httpd.conf有下面这一行,这个代表安装了mod_rewrite吗?
1.jpg (36.56 KB, 下载次数: 7)
15:53 上传
各位兄弟们,麻烦不吝赐教呀,小弟不胜感激
打开就可以,配置文件默认不支持.htaccess需开启
xiaoyuwxz 发表于
打开就可以,配置文件默认不支持.htaccess需开启
我的是独立主机,麻烦请问如何开启.htaccess呢?
AllowOverride none 改
AllowOverride All
xiaoyuwxz 发表于
AllowOverride none 改
AllowOverride All
请问这个修改时在那个文件里修改呢?
xiaoyuwxz 发表于
AllowOverride none 改
AllowOverride All
这个修改了,还是不起作用,只要在httpd.conf里面加上如下代码,apache重启时,就提示启动失败!
&IfModule mod_rewrite.c&
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%
3D$4&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3&%1
&/IfModule&
独立主机还要开启.htaccess支持, 没事增加负载吗? 嫌速度太快了是吧..
Powered by

我要回帖

更多关于 libapache2 mod php5 的文章

 

随机推荐