MAC 10.8系统配置SVN

来源:互联网 发布:魔兽世界单机版 知乎 编辑:程序博客网 时间:2024/06/03 20:16

1、创建svn仓库:
创建一个保存数据的目录,我用的是其它网友的目录 /opt/svn/repos

      sudo su (然后输入密码)

mkdir /opt

mkdir /opt/svn
mkdir /opt/svn/repos
即创建了目录/opt/svn/repos/

进入到仓库配置目录 cd /opt/svn/repos/conf

2、编辑配置文件 vi svnserve.conf 取消下列行的注释
anon-access = read
auth-access = read
password-db = passwd (密码配置的保存文件)
auth-db = authz (认证配置的保存文件)

C代码  收藏代码
  1. ### This file controls the configuration of the svnserve daemon, if you  
  2. ### use it to allow access to this repository.  (If you only allow  
  3. ### access through http: and/or file: URLs, then this file is  
  4. ### irrelevant.)  
  5.   
  6. ### Visit http://subversion.tigris.org/ for more information.  
  7.   
  8. [general]  
  9. ### These options control access to the repository for unauthenticated  
  10. ### and authenticated users.  Valid values are "write", "read",  
  11. ### and "none".  The sample settings below are the defaults.  
  12. anon-access = read  
  13. auth-access = write  
  14. ### The password-db option controls the location of the password  
  15. ### database file.  Unless you specify a path starting with a /,  
  16. ### the file's location is relative to the directory containing  
  17. ### this configuration file.  
  18. ### If SASL is enabled (see below), this file will NOT be used.  
  19. ### Uncomment the line below to use the default password file.  
  20. password-db = passwd  
  21. ### The authz-db option controls the location of the authorization  
  22. ### rules for path-based access control.  Unless you specify a path  
  23. ### starting with a /, the file's location is relative to the the  
  24. ### directory containing this file.  If you don't specify an  
  25. ### authz-db, no path-based access control is done.  
  26. ### Uncomment the line below to use the default authorization file.  
  27. authz-db = authz  
  28. ### This option specifies the authentication realm of the repository.  
  29. ### If two repositories have the same authentication realm, they should  
  30. ### have the same password database, and vice versa.  The default realm  
  31. ### is repository's uuid.  
  32. # realm = My First Repository  
  33.   
  34. [sasl]  
  35. ### This option specifies whether you want to use the Cyrus SASL  
  36. ### library for authentication. Default is false.  
  37. ### This section will be ignored if svnserve is not built with Cyrus  
  38. ### SASL support; to check, run 'svnserve --version' and look for a line  
  39. ### reading 'Cyrus SASL authentication is available.'  
  40. # use-sasl = true  
  41. ### These options specify the desired strength of the security layer  
  42. ### that you want SASL to provide. 0 means no encryption, 1 means  
  43. ### integrity-checking only, values larger than 1 are correlated  
  44. ### to the effective key length for encryption (e.g. 128 means 128-bit  
  45. ### encryption). The values below are the defaults.  
  46. # min-encryption = 0  
  47. # max-encryption = 256  

 注意删除后上面不要留空格,不然会报错:

Txt代码  收藏代码
  1. .subversion/config:94: Option expected  

3、编辑认证文件 vi authz

格式为 [groups]
用户组名 = 用户组成员
[需要授权的目录]
@组名 = 权限
用户名 = 权限

Txt代码  收藏代码
  1. ### This file is an example authorization file for svnserve.  
  2. ### Its format is identical to that of mod_authz_svn authorization  
  3. ### files.  
  4. ### As shown below each section defines authorizations for the path and  
  5. ### (optional) repository specified by the section name.  
  6. ### The authorizations follow. An authorization line can refer to:  
  7. ###  - a single user,  
  8. ###  - a group of users defined in a special [groups] section,  
  9. ###  - an alias defined in a special [aliases] section,  
  10. ###  - all authenticated users, using the '$authenticated' token,  
  11. ###  - only anonymous users, using the '$anonymous' token,  
  12. ###  - anyone, using the '*' wildcard.  
  13. ###  
  14. ### A match can be inverted by prefixing the rule with '~'. Rules can  
  15. ### grant read ('r') access, read-write ('rw') access, or no access  
  16. ### ('').  
  17.   
  18. [aliases]  
  19. # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average  
  20.   
  21. [groups]  
  22. # harry_and_sally = harry,sally  
  23. # harry_sally_and_joe = harry,sally,&joe  
  24.   
  25. # [/foo/bar]  
  26. # harry = rw  
  27. # &joe = r  
  28. # * =  
  29.   
  30. # [repository:/baz/fuz]  
  31. # @harry_and_sally = rw  
  32. # * = r  
  33. test=hilary  
  34. [/]  
  35. hilary=rw  
4编辑密码配置文件 vi passwd

 

Txt代码  收藏代码
  1. ### This file is an example password file for svnserve.  
  2. ### Its format is similar to that of svnserve.conf. As shown in the  
  3. ### example below it contains one section labelled [users].  
  4. ### The name and password for each user follow, one account per line.  
  5.   
  6. [users]  
  7. # harry = harryssecret  
  8. # sally = sallyssecret  
  9. #username = password  
  10. hilary=3113  
5.启动svnserve
svnserve -d -r /opt/svn/repos
结束服务可以用 killall -9 svnserve

svn地址:svn://localhost

注:很可能会遇到权限问题,可使用 sudo 命令
sudo chflags -R nouchg /opt/svn/repos

sudo chown -R UserName /opt/svn/repos
sudo chmod -R 755 /opt/svn/repos






///////////////////////////////////////////////////////////////////////////////////

Mac OS 系统已经内置了svn支持,所以需要做的就只是配置,可以用svn --version查看。

 

1.建立想要保存软件仓库的目录。 并在系统设置里面打开Web共享(Apache2)。
sudo su (然后输入密码)
mkdir /opt
mkdir /opt/svn
mkdir /opt/svn/repos
即创建了目录/opt/svn/repos/

2.创建版本仓库 svnadmin create /opt/svn/repos

3.修改授权配置
进入到仓库配置目录 cd /opt/svn/repos/conf
(1)编辑配置文件 vi svnserve.conf 取消下列行的注释
anon-access = read
auth-access = write

password-db = passwd (密码配置的保存文件)
auth-db = authz (认证配置的保存文件)

(2)编辑密码配置文件 vi passwd
格式为 “用户名 = 密码”

(3)编辑认证文件 vi authz
格式为 [groups]
用户组名 = 用户组成员
[需要授权的目录]
@组名 = 权限
用户名 = 权限
例如:
[groups]
g_developers = jcccn,jesse,bill
g_tester = jerry,wang
[/]
@g_developer = r
jcccn = rw
* =
[/jcccn]
@g_tester = rw
jcccn = rw
* = r

(4)配置忽略文件 vi ~/.subversion/config

如果”.subversion”目录不存在,请运行”svn status”命令,虽然此命令会失败,但是会为你创建所需要的文件。

找到 global-ignores 一行,去掉注释,编辑成:
global-ignores = build *~.nib *.so *.pbxuser *.mode *.perspective*

找到 enable-auto-props = yes 把注释去掉,在[auto-props] Section声明以下文本文件:
*.mode* = svn:mime-type=text/X-xcode
*.pbxuser = svn:mime-type=text/X-xcode
*.perspective* = svn:mime-type=text/X-xcode
*.pbxproj = svn:mime-type=text/X-xcode

4.启动svnserve :
svnserve -d -r /opt/svn/repos
结束服务可以用 killall -9 svnserve

注:很可能会遇到权限问题,可使用 sudo 命令,SVN的DB文件如果是ROOT的,要改为用户权限:
sudo chown -R UserName /opt/svn/repos
sudo chmod -R 755 /opt/svn/repos

另,如有SVN文件是从其它地方Copy到Mac硬盘上的,就会碰到“Operation not permitted”(大意:你丫没事吧,瞎得瑟啥,哥的文件你动不了)的提示。

咋整咧?

请使用 sudo chflags -R nouchg /opt/svn/repos

简而言之,如果SVN目录碰到奇怪滴权限问题,大体三步走即可搞定:
sudo chflags -R nouchg /opt/svn/repos
sudo chown -R UserName /opt/svn/repos
sudo chmod -R 755 /opt/svn/repos

最后友情建议,别忘了先 “Clean up”~

以上引用:http://www.teanie.com/mac-os-x-svn.html?utm_source=rss&utm_medium=rss&utm_campaign=mac-os-x-svn



如果创建文件夹时遇到这样的问题:svn: Can't create directory '/opt/svn/repos': Permission denied,可以通过切换到root账户解决,具体方案,请参考我上一篇转载的日志。

如果原本端口已被占用,通过:svnserve -d --listen-port 2122 -r /opt/svn/repos 使用其它端口。

查看svn状态的时候,出现:svn: warning: '.' is not a working copy
 


如何使用xcode自带的SCM,请参考精品论坛:http://www.cocoachina.com/bbs/read.php?tid-1513.html


///////////////////////////////

mac svn 删除.svn隐藏文件的命令

打开终端,进到所在的目录,然后出入一下代码

find . -name ".svn" | xargs rm -Rf


1、将文件checkout到本地目录
svn checkout path(path是服务器上的目录)
例如:svn checkout svn://192.168.1.1/pro/domain
简写:svn co

2、往版本库中添加新的文件
svn add file
例如:svn add test.php(添加test.php)
svn add *.php(添加当前目录下所有的php文件)

svn add xxx@2x.png 文件时, 正常命令 svn add xxx@2x.png 会报 xxx not found

需用 svn add xxx@2x.png@  来添加,也就是图片名字后面再添加一个@ 符号,

这是因为 svn 命令最后需要用@符号来指定一个版本导致的

遇到 xxx@2x.png文件时,如果用svn命令行添加到 版本库的话,只能手动一个一个添加,不能批量添加

3、将改动的文件提交到版本库
svn commit -m “LogMessage“ [-N] [--no-unlock] PATH(如果选择了保持锁,就使用–no-unlock开关)
例如:svn commit -m “add test file for my test“ test.php
简写:svn ci

4、加锁/解锁
svn lock -m “LockMessage“ [--force] PATH
例如:svn lock -m “lock test file“ test.php
svn unlock PATH

5、更新到某个版本
svn update -r m path
例如:
svn update如果后面没有目录,默认将当前目录以及子目录下的所有文件都更新到最新版本。
svn update -r 200 test.php(将版本库中的文件test.php还原到版本200)
svn update test.php(更新,于版本库同步。如果在提交的时候提示过期的话,是因为冲突,需要先update,修改文件,然后清除svn resolved,最后再提交commit)
简写:svn up

6、查看文件或者目录状态
1)svn status path(目录下的文件和子目录的状态,正常状态不显示)
【?:不在svn的控制中;M:内容被修改;C:发生冲突;A:预定加入到版本库;K:被锁定】
2)svn status -v path(显示文件和子目录状态)
第一列保持相同,第二列显示工作版本号,第三和第四列显示最后一次修改的版本号和修改人。
注:svn status、svn diff和 svn revert这三条命令在没有网络的情况下也可以执行的,原因是svn在本地的.svn中保留了本地版本的原始拷贝。
简写:svn st

7、删除文件
svn delete path -m “delete test fle“
例如:svn delete svn://192.168.1.1/pro/domain/test.php -m “delete test file”
或者直接svn delete test.php 然后再svn ci -m ‘delete test file‘,推荐使用这种
简写:svn (del, remove, rm)

8、查看日志
svn log path
例如:svn log test.php 显示这个文件的所有修改记录,及其版本号的变化

9、查看文件详细信息
svn info path
例如:svn info test.php

10、比较差异
svn diff path(将修改的文件与基础版本比较)
例如:svn diff test.php
svn diff -r m:n path(对版本m和版本n比较差异)
例如:svn diff -r 200:201 test.php
简写:svn di

11、将两个版本之间的差异合并到当前文件
svn merge -r m:n path
例如:svn merge -r 200:205 test.php(将版本200与205之间的差异合并到当前文件,但是一般都会产生冲突,需要处理一下)

12、SVN 帮助
svn help
svn help ci

13、版本库下的文件和目录列表
svn list path
显示path目录下的所有属于版本库的文件和目录
简写:svn ls

14、创建纳入版本控制下的新目录
svn mkdir: 创建纳入版本控制下的新目录。
用法: 1、mkdir PATH…
2、mkdir URL…
创建版本控制的目录。
1、每一个以工作副本 PATH 指定的目录,都会创建在本地端,并且加入新增
调度,以待下一次的提交。
2、每个以URL指定的目录,都会透过立即提交于仓库中创建。
在这两个情况下,所有的中间目录都必须事先存在。

15、恢复本地修改
svn revert: 恢复原始未改变的工作副本文件 (恢复大部份的本地修改)。revert:
用法: revert PATH…
注意: 本子命令不会存取网络,并且会解除冲突的状况。但是它不会恢复
被删除的目录

16、代码库URL变更
svn switch (sw): 更新工作副本至不同的URL。
用法: 1、switch URL [PATH]
2、switch –relocate FROM TO [PATH...]
1、更新你的工作副本,映射到一个新的URL,其行为跟“svn update”很像,也会将
服务器上文件与本地文件合并。这是将工作副本对应到同一仓库中某个分支或者标记的
方法。
2、改写工作副本的URL元数据,以反映单纯的URL上的改变。当仓库的根URL变动
(比如方案名或是主机名称变动),但是工作副本仍旧对映到同一仓库的同一目录时使用
这个命令更新工作副本与仓库的对应关系。

17、解决冲突
svn resolved: 移除工作副本的目录或文件的“冲突”状态。
用法: resolved PATH…
注意: 本子命令不会依语法来解决冲突或是移除冲突标记;它只是移除冲突的
相关文件,然后让 PATH 可以再次提交。

18、输出指定文件或URL的内容。
svn cat 目标[@版本]…如果指定了版本,将从指定的版本开始查找。
svn cat -r PREV filename > filename (PREV 是上一版本,也可以写具体版本号,这样输出结果是可以提交的)

////////////////////////////////////////////////////////////
Subversion 错误信息一览表 


Subversion 错误信息一览表 
注意: 

1.不同的客户端(命令行,TortoiseSVN, AnkhSVN, Subclipse等)的出错信息可能稍有不同。 

2.下面表格中的出错信息以 http://svn.moon.ossxp.com/svn/test 版本库做示例,仅供参考。 



编号 
出错信息 
问题剖析 
解决方案 

1. 
svn: Server sent unexpected return value (500 Internal Server Error) in response to OPTIONS request for 'http://svn.moon.ossxp.com/svn/test' 
错误的用户名 
检查登录的用户名是否输入错误 

svn: 服务器发送了意外的返回值(500 Internal Server Error),在响应 “OPTIONS” 的请求 “http://svn.moon.ossxp.com/svn/test” 中 

2. 
svn: OPTIONS of 'http://svn.moon.ossxp.com/svn/test': authorization failed: Could not authenticate to server: rejected Basic challenge (http://svn.moon.ossxp.com) 
错误的口令 
用正确的用户名/口令登录 

svn: 方法 OPTIONS 失败于 “http://svn.moon.ossxp.com/svn/test”: 认证失败: Could not authenticate to server: rejected Basic challenge (http://svn.moon.ossxp.com) 

3. 
svn: Server sent unexpected return value (403 Forbidden) in response to OPTIONS request for 'http://svn.moon.ossxp.com/svn/test' 
用户无权限 
联系管理员,为用户分配权限 

svn: 服务器发送了意外的返回值(403 Forbidden),在响应 “OPTIONS” 的请求 “http://svn.moon.ossxp.com/svn/test” 中 

4. 
svn: OPTIONS of 'http://www.moon.ossxp.com/svn/test': 200 OK (http://www.moon.ossxp.com) 
服务器地址错误,是普通Web页面,不支持SVN的 WebDAV 协议 
确认输入正确的 SVN 服务地址。可以在浏览器中输入该地址进行确认 

svn: 方法 OPTIONS 失败于 “http://www.moon.ossxp.com/svn/test”: 200 OK (http://www.moon.ossxp.com) 

5. 
The version of your subversion (client) is below 1.5.0, upgrade to 1.5.0 or above. SVN below 1.5.0 can not handle mergeinfo properly. It can mess up our automated merge tracking! 
是由于客户端的软件版本低于1.5.0造成的。服务器端对客户端软件版本进行了限制,以免对合并跟踪破坏。 
升级本地的Subversion客户端软件到1.5.0或以上版本。 

6. 
svn: This client is too old to work with working copy '.'. You need to get a newer Subversion client, or to downgrade this working copy. See http://subversion.tigris.org/faq.html#working-copy-format-change for details.
安装了多个版本的SVN客户端(TSVN,Subclipse,...),且各个客户端的版本不一致。高版本的SVN客户端会自动更新本地工作目录中的 .svn 目录下的文件格式,导致旧版本的SVN客户端不能继续访问该本地工作目录 
将本机安装的所有的SVN客户端都更新到同一个大版本,以避免本地工作目录的格式不一致 

svn: 此客户端对于工作副本 “.” 太旧。你需要取得更新的 Subversion 客户端,或者降级工作副本。 参见 http://subversion.tigris.org/faq.html#working-copy-format-change 以获得更详细的信息。 

7. 
svn: Working copy 'trunk/src' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) 
异常操作导致目录没有解锁。 
一个简单的重现方法:在 .svn 目录下创建空的名为 lock的文件 
使用命令行 "svn cleanup" 或者类似的“清理”动作删除锁定 

svn: 工作副本“trunk/src”已经锁定 svn: 运行“svn cleanup”删除锁定 (输入“svn help cleanup”得到用法) 

8. 
日志中没有作者信息: ------------------------------------ r9 | (没有作者信息) | … ossxp.com anonymous commit test
匿名提交导致没有作者信息 
检查版本库权限控制,禁止匿名提交 

9. 
正在发送 ... 传输文件数据.svn: 提交失败(细节如下): svn: Commit blocked by pre-commit hook (exit code 1) with output: 提交说明至少应包含 4 个字符, 或者太简单了。 
这是由于用户提交的提交说明(commit log),太过简单了。在提交时需要输入有意义的 commit log。 
写有意义的提交说明,或者请求管理员更改版本库插件 

10. 
增加 Logger.c 传输文件数据.svn: 提交失败(细节如下): svn: Commit blocked by pre-commit hook (exit code 1) with output: Wide character in print at /opt/svn/svnroot/myrepos/hooks/scripts/check-case-insensitive.pl line 259. 发现文件名大小写冲突: trunk/src/Logger.c 已经存在于 logger.c 
管理员设置了对新增文件是否重名(只有大小写不同)的文件进行检查。文件名只有大小写不同,在Windows上进行检出会造成麻烦 
不要添加重名(仅大小写不同)文件 

增加 src/文件aBc.txt 传输文件数据.svn: 提交失败(细节如下): svn: Commit blocked by pre-commit hook (exit code 1) with output: Clash: '/trunk/src/文件aBc.txt' '/trunk/src/文件abc.txt' 

11. 
svn: While preparing '/home/jiangxin/tmp/svn.test/trunk/src/README.txt' for commit svn: Inconsistent line ending style 
提交的文件已经设置了 svn:eol-style 属性,但是该文本内的换行符有DOS的换行符CRLF,也有Unix换行符LF,不一致! 
统一该文本文件内的换行符。Linux 下可以用dos2unix, unix2dos, sed等命令。Windows下可用UltraEdit 进行转换。 

svn: 当为提交操作准备“/home/jiangxin/tmp/svn.test/trunk/src/README.txt”时 svn: 不一致的行结束样式 

12. 
svn: Failed to add file 'Makefile': an unversioned file of the same name already exists 
执行更新(svn up)时报错。因为其他人新增一个文件到服务器,而本地却存在一个同名文件(未版本控制) 
先将本地重名文件改名,再执行"svn up",之后再比较、合并文件。或者执行 "svn up --force" 

svn: 增加文件 'Makefile' 失败: 同名未版本控制的文件已存在 

13. 
Adding src/Makefile svn: Commit failed (details follow): svn: File '/svn/test/trunk/src/Makefile' already exists 
添加新文件,提交时报错。因为其他人已经先于我增加了该文件。 
先执行更新操作("svn up"),再根据提示进行操作:合并/提交... 

增加 src/Makefile svn: 提交失败(细节如下): svn: 文件“/svn/test/trunk/src/Makefile”已存在 

14. 
$ svn up Conflict discovered in 'Makefile'. Select: (p) postpone, (df) diff-full, (e) edit, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: p C Makefile Updated to revision 5. Summary of conflicts: Text conflicts: 1 
多人同时编辑同一个文件时,可能会遇到冲突。别人先于我提交,则当我提交时要先更新。更新可能遇到不能自动解决的冲突 
使用工具进行冲突解决 

$ svn up 在 “Makefile” 中发现冲突。 选择: (p) 推迟,(df) 显示全部差异,(e) 编辑, (mc) 我的版本, (tc) 他人的版本, (s) 显示全部选项: p C Makefile 更新到版本 5。 冲突概要: 正文冲突:1 

15. 
svn: Commit failed (details follow): svn: File 'Makefile' is out of date svn: File not found: transaction '6-d', path '/trunk/src/Makefile' 
提交的文件已被他人删除 
先执行更新操作("svn up"),再根据提示解决该树冲突:删除文件或继续添加... 

svn: 提交失败(细节如下): svn: 文件 “Makefile” 已经过时 svn: File not found: transaction '6-c', path '/trunk/src/Makefile' 

16. 
svn: Commit failed (details follow): svn: File or directory '/trunk/XXX' is out of date; try updating svn: resource out of date; try updating 
基于旧版本修改是不允许的 
先更新("svn update"),再提交 

svn: 提交失败(细节如下): svn: 文件或目录 “/trunk/XXX” 已经过时;请先更新 svn: resource out of date; try updating 

17. 
svn: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent svn: At least one property change failed; repository is unchanged svn: Error setting property 'log': Repository has not been enabled to accept revision propchanges; ask the administrator to create a pre-revprop-change hook 
修改提交说明等操作属于高风险操作,因为该操作没有被版本控制,属于不可恢复的操作。缺省禁止。 
请联系管理员,启用该版本的相关钩子,允许修改“版本属性”。参见 管理员钩子设置 

svn: DAV 请求失败;可能是版本库的 pre-revprop-change 钩子执行失败或者不存在 svn: 至少有一个属性变更失败;版本库未改变 svn: 设置属性 “log” 出错: Repository has not been enabled to accept revision propchanges; ask the administrator to create a pre-revprop-change hook 

18. 
传输文件数据.svn: 提交失败(细节如下): svn: Commit blocked by pre-commit hook (exit code 1) with output: ==================== trunk/src/File.c : 属性 svn:mime-type 或者 svn:eol-style 没有设置 ==================== 管理员已经启用换行符属性检查。每一个新添加的文件必须 指定换行符。如果 svn:mime-type 属性为文本文件,则 必须设置 svn:eol-style 属性。 对于二进制文件,执行如下命令: svn propset svn:mime-type application/octet-stream path/of/file 对于文本文件,可以执行如下命令: svn propset svn:mime-type text/plain path/of/file svn propset svn:eol-style native path/of/file 为了避免每次添加文件手动设置,可以启用自动属性设置 ... 
管理员启用了检查新文件换行符的扩展 
为新增文件设置正确的 svn:mime-type 和/或 svn:eol-style 属性 


////////////////////////////////////////

升级到 Mountain Lion 后发现 pac 文件不起作用,检查一番后发现“Web Sharing”这个选项干脆从 System Preferences > Sharing 中消失了,这让一直用 localhost 做些“坏事”的 Lucifr 很不适应。好在 Google 还是给力的,几下就找到了解决方法,分享一下开启 Apache/Web Sharing 的方法:

  1. 打开 Terminal(终端)(其实我更喜欢 iTerm)。

  2. 使用以下命令可以对 Apache 进行相应的操作:

    启动:

    sudo apachectl start 

    停止:

    sudo apachectl stop 

    重启:

    sudo apachectl restart 

    查看 Apache 版本:

    httpd -v 

    ML 中安装的 Apache 版本是 2.2.22。

  3. 使用启动命令之后,在浏览器中输入 http://localhost 如果看到“It works!”就说明成功了。

  4. 但这时用户根目录(http://localhost/~username)还不能访问,为了让 ~/Sites 下面的内容可以访问,继续以下的几个步骤。

  5. 看看 username.conf 文件是否存在:

    ls /etc/apache2/users/ 
  6. 如果没有见到你的用户名命名的 .conf 文件,那么就需要手动建立一个:

    cd /etc/apache2/users/&&sudo vi username.conf 

    注意你需要把 username 换成你的用户名;另外 Lucifr 这里用的是 vi 来进行编辑,当然也可以用 nano。

  7. 粘贴以下内容,同样注意替换你的用户名:

    <Directory "/Users/username/Sites/"> Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all </Directory> 
  8. 保存退出后重启下 Apache:

    sudo apachectl restart 
  9. 访问 http://localhost/~username/ 应该可以看到“您的网站”了。



原创粉丝点击