MacOSX中配置Apache
1.启动Apache
打开 “iTerm”-我安装的这个也可以用自带的 "终端(terminal)",
输入 sudo apachectl -v 查看Apache版本号
启动 sudo apachectl start
这样Apache就启动了。打开Safari浏览器地址栏输入 “http://localhost”,可以看到内容为“It works!”的页面
默认的根目录 “/Library(资源库)/WebServer/Documents/”
apache的目录是在 “/etc/apache2/” 如果找不到该目录那就自行百度吧
2.设置虚拟主机
本人小菜鸟Vim编辑器不太会用,容我使用Notepad
在 /etc/apache2/httpd.conf 中找到“#Include /private/etc/apache2/extra/httpd-vhosts.conf”,去掉前面的“#”
重启apache sudo apachectl restart
重启Apache后就开启了虚拟主机配置功能
在 /etc/apache2/extra/httpd-vhosts.conf 中添加以下配置:(注意DocumentRoot请自行修改)
在 /etc/hosts 中加入"127.0.0.1 mysites"
重启apache sudo apachectl restart
这样就可以配置完成sites虚拟主机了,可以访问“http://mysites”
2.权限设置
这样就可以配置完成sites虚拟主机了,可以访问“http://mysites”
8.权限问题
在apache2目录下的httpd.conf
这里改成
重启apache sudo apachectl restart
OK 搞定
当前名称:MacOSX中配置Apache
地址分享:http://myzitong.com/article/cjgpog.html