XAMPP on Mac 配置 Virual Host
sudo nano /private/etc/hosts
# VirtualHosts Mapping 127.0.0.1 dev-domainname.com
接下来配置Apache,打开Apache的配置文件 /Applications/XAMPP/etc/httpd.conf
# Virtual hosts # Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
# Virtual hosts Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
在以上httpd-vhosts.conf里添加Virtual Host的配置
# localhost <VirtualHost *:80> ServerName localhost DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" <Directory "/Applications/XAMPP/xamppfiles/htdocs"> Options Indexes FollowSymLinks Includes execCGI AllowOverride All Require all granted </Directory> </VirtualHost>
# My custom host <VirtualHost *:80> ServerName mysite.local DocumentRoot "/Users/yourusername/path/to/your/site" <Directory "/Users/yourusername/path/to/your/site"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory> ErrorLog "logs/mysite.local-error_log" </VirtualHost>
重启Apache,访问dev-domainname.com出现403错误,在httpd.conf里面搜索User Deamon,把deamon改成OS的用户名,重启Apache,就可以了。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。