XAMPP on Mac configuration Virual Host, xamppvirual
First add the virtual host domain name in the hosts file, pointing to 127.0.0.1 I generally use the naming rules is dev-domainname.com
sudo nano /private/etc/hosts
# VirtualHosts Mapping127.0.0.1 dev-domainname.com
Configure Apache and open the configuration file/Applications/XAMPP/etc/httpd. conf of Apache.
Search for "Virtual hosts"
# Virtual hosts# Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
Open the comment on the second line, And let Apache Read the configuration file of the virtual host.
# Virtual hostsInclude /Applications/XAMPP/etc/extra/httpd-vhosts.conf
Add Virtual Host configuration in the httpd-vhosts.conf above
# 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>
Restart Apache, access dev-domainname.com error 403, in httpd. conf Search User Deamon, change deamon to OS User name, restart Apache, you can.