环境

OS X 10.11.5

$ apachectl -v
Server version: Apache/2.4.18 (Unix)
Server built:   Feb 20 2016 20:03:19

$ php -v
PHP 5.5.34 (cli) (built: Apr 22 2016 19:16:58)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

Host

/etc/hosts

127.0.0.1 luka.web

vhosts 配置

80端口给了Nginx, Apache就用8029端口了.

$ vi /etc/apache2/httpd.conf

Listen 8029

$ cat /etc/apache2/other/lukaweb.conf
<VirtualHost *:8029>
    DocumentRoot /Library/WebServer/Documents/lukaweb
    ServerName  luka.web
    <Directory "/Library/WebServer/Documents/lukaweb">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order deny,allow
                Allow from all
      </Directory>

    ErrorLog "/Users/cbd/vm/zlogs/luka.err.log"
    CustomLog "/Users/cbd/vm/zlogs/luka.common.log" common
</VirtualHost>

根目录 指向

$ ls -alF /Library/WebServer/Documents
total 96
drwxr-xr-x  8 root  wheel    272  6  5 16:23 ./
drwxr-xr-x  5 root  wheel    170  2 21 12:06 ../
lrwxr-xr-x  1 root  wheel     27  6  5 16:23 lukaweb@ -> /Users/cbd/vm/luka/lukaweb/
...
...
...

重启Apache2

$ sudo apachectl restart

查看

http://luka.web:8029/