mac自带apache服务器开启

mac的os x操作系统自带的有apach服务器, 命令行:

sudo apachectl -v 可查看自带apache版本信息

输入:

sudo apachectl start 就开启了apache, 可用localhost或者127.0.0.1看it works

服务器路径在 硬盘 /资源库(Library)/WebServer/Documents

如果要在apache里checkOut svn文件,会提示没有权限,输入命令开启权限:

:sudo chmod -R 777 /Library/WebServer/Documents

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

当放置了自己项目后,如果发现无法访问自己项目的目录,遇到 403 Forbidden, 也是权限问题,需要更改apache配置文件:

命令行: open /etc ,

修改/etc/apache2/httpd.conf文件,

把Options FollowSymLinks Multiviews改成Options Indexes FollowSymLinks Multiviews

<Directory />
     AllowOverride none
     Require all granted
     Allow from all
</Directory>
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
    Options Indexes FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
</Directory>