首页 > Web开发 > 详细

Mac10.11.2 Apache 服务配置

时间:2015-12-29 21:08:29      阅读:260      评论:0      收藏:0      [点我收藏+]

系统默认是隐藏apache安装目录的,但我们可以通过“命令行”或者“文件夹前往”的方式找到它。它是安装在系统的私有目录下,也就是/private/etc下面,因为它是隐藏的,所以我们无法通过界面找到它

1、启动:

sudo apachectl start

 

2、重启/停止

sudo apachectl restart

 sudo apachectl stop

 

3、创建个人站点目录

cd ~/

mkdir Sites

echo "hello" >> index.html

sudo apachectl restart

技术分享

4、启用虚拟主机

默认情况下,apache的虚拟主机功能是关闭的,在“/etc/apache2/httpd.conf”中找到下面这行:

#Include /private/etc/apache2/extra/httpd-vhosts.conf

将前面的#去掉,然后再打开“/etc/apache2/extra/httpd-vhosts.conf”,内容修改成类似下面的样子:

<VirtualHost *:8081>
    DocumentRoot "/Users/huhmf/Sites"
    ServerName www.huhmf.com
    ErrorLog "/Users/huhmf/Sites/log/error.log"
    CustomLog "/Users/huhmf/Sites/log/access.log" common
    <Directory />
	  Options Indexes FollowSymLinks MultiViews
	  AllowOverride None
	  Require all granted
	</Directory>
</VirtualHost>

 5、修改apache默认端口

同样是在httpd.conf下面,找到Listen 80 那一行,修改成你想要的端口即可。

技术分享

6、修改host,使用命令:sudo vi /etc/hosts

127.0.0.1    www.huhmf.com

 

访问服务器:

技术分享

转自:http://www.cnblogs.com/yjmyzz/p/3920361.html

 

Mac10.11.2 Apache 服务配置

原文:http://www.cnblogs.com/dhui69/p/5086957.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!