10 09/2014

mac apache vhost

最后更新: Wed Sep 10 2014 12:39:11 GMT+0800

编辑 /etc/apache2/httpd.conf

sudo nano /etc/apache2/httpd.conf

打开虚拟目录

# Virtual hosts

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

编辑 httpd-vhosts.conf

sudo nano /etc/apache2/extra/httpd-vhosts.conf

内容为:


    ServerAdmin davidguoshuang@gmail.com
    DocumentRoot "/Users/david/workshop"
    ServerName gs
    ServerAlias gs
    ErrorLog "/Users/david/workshop/apache-error.log"
    CustomLog "/Users/david/workshop/apache-access.log" common
    <Directory "/Users/david/workshop">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

编辑 hosts,添加“域名”

sudo nano /etc/hosts

添加

127.0.0.1 gs

重启 apache

sudo apachectl restart

浏览器访问 http://gs/

via how-set-virtual-hosts-apache-mac