首页 / APACHE / Mac下配置apache
Mac下配置apache
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Mac下配置apache,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1813字,纯文字阅读大概需要3分钟。
内容图文
一、前言
今天遇到问题,怎么配置apache在Mac上,原来Mac自带apache,只需要自己开启配置一下就行了。
二、步骤:
1、修改apache的http_conf文件
打开finder前往/private/etc/apache2,在这个文件加下有一个http.conf用文本编辑器打开。
修改第一处:查找php。得到如下结果
#LoadModule php5_module libexec/apache2/libphp5.so
去掉前面的#号。
修改第二处:查找documentRoot。会找到类似的语句
# # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/Users/admin/Sites" <Directory "/Users/admin/Sites"> # # 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
在DocumentRoot “”引号中填入自己的路径。我的是在Users/admin/Sites,同时把紧挨着的Directory的“”引号后面也修改为自己的路径。
修改第三处:查找:directory.会找到类似的语句
# # "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/Library/WebServer/CGI-Executables"> AllowOverride None Options None Require all granted </Directory> <IfModule mime_module> # # TypesConfig points to the file containing the list of mappings from # filename extension
将<Directory></Directory>中的内容修改为我上面的。
然后保存。
第二步:重启apache
下边是用到的命令
停止服务:sudo /usr/sbin/apachectl stop 开启服务:sudo /usr/sbin/apachectl start 重启服务:sudo /usr/sbin/apachectl restart
然后在你刚在指定的文件夹下新建一个php文件测试即可。(我的在/Users/admin/Sites)
原文:http://www.cnblogs.com/zhanggui/p/4458134.html
内容总结
以上是互联网集市为您收集整理的Mac下配置apache全部内容,希望文章能够帮你解决Mac下配置apache所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。