-
Mac OS X 系统已经集成了 Apache+PHP 环境,依次进入“系统偏好设置 -> 共享” ,开启“Web 共享”,就可以打开 Apache。
但新版的 Mac OS X 中,苹果取消了这个共享功能的图形界面,只能从命令行开启。
-
在终端里输入命令,启动 Apache: sudo apachectl start
关闭 Apache: sudo apachectl stop
重启 Apache:sudo apachectl restart
查看 Apache 版本:httpd -v
Mac OS X 10.9.X 中的 Apache 版本信息:
Server version: Apache/2.2.26 (Unix) Server built: Dec 10 2013 22:09:38
-
启用 Apache 之后,在浏览器中访问 http://localhost 或 http://127.0.0.1,如果出现“It works!”就表示运行正常。
-
以上内容来自http://jingyan.baidu.com/article/0aa22375b553a488cc0d64b5.html ,
-
不过我在修改/etc/apache2/httpd.conf配置,将默认的项目路径由 /Library/WebServer/Documents/ 都替换成自己的路径,比如 /Users/juliana/myphpspace
-
重启apache后,报403 Forbidden,You don't have permission to access/on this server ,解决方案:
-
1).将#<Directory />
# AllowOverride none
# Require all denied
#</Directory> -
改为:<Directory />
Options Indexes FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory> -
2).将AllowOverride None改为AllowOverride All
-
DocumentRoot "/Users/juliana/newsp/testing/Test/www"
<Directory "/Users/juliana/newsp/testing/Test/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks Multiviews
MultiviewsMatch Any
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
# AllowOverride None
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
-
然后重启apache服务器,就正常了!
Mac Os自带Apache修改自定义项目配置报403 Forbidden, You don't have permission to access/on this server解决
最新推荐文章于 2025-05-19 12:17:48 发布