10
09/2014
mac apache vhost
编辑 /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/