配置文件路径:
/etc/apache2/httpd.conf
在目录:/etc目录下进行
1.打开终端,进入到上述目录下
cd /etc
-
输入命令启动服务器
sudo apachectl -k start
3.重启服务器
sudo apachectl -k restart
4.关闭服务器
sudo apachectl -k stop
5、多项目配置
先找到监听接口添加相应的端口号:
<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>
Listen 80
Listen 81
</IfDefine>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/Users/jianlongnie/workspace/ms_mall/multi_mall"
ServerName www.demoa.com
ErrorLog "/private/var/log/apache2/dummy-host2.server1.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.server1.com-access_log" common
</VirtualHost>
<VirtualHost *:81>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/Users/jianlongnie/workspace/ms_mall/single_mall"
ServerName www.democ.com
ErrorLog "/private/var/log/apache2/dummy-host2.server2.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.server2.com-access_log" common
</VirtualHost>
修改hosts:
127.0.0.1 www.demoa.com
127.0.0.1 www.democ.com
访问浏览器:
http://www.democ.com:81/install.php
http://www.demoa.com/install.php
齐活!!!
网友评论