Problems Encountered Configuring XAMPP for Multi-site with Local Domain Binding on MAC
I’ve always been running PHP environment in virtual machines. Today I wanted to install an environment on Mac to try, and finally chose XAMPP.
OK, here’s the problem - XAMPP doesn’t support multi-site, but I want to access different sites with multiple domain names. Searched online for a long time, all solutions were copy-pasted, I really don’t know how you configured after copying.
Let’s do it myself
Local environment:
OSX 10.13.1 XAMPP-VM (PHP 7.1.11)
Requirements:
XAMPP multi-site access with domain binding
First modify the config file httpd-vhosts.conf
vi /opt/lampp/etc/extra/httpd-vhosts.confAdd configuration at the bottom of the file
<VirtualHost *:80> ServerAdmin 757118@qq.com DocumentRoot "/opt/lampp/htdocs/111.com" ServerName 111.com ErrorLog "logs/111.com-error_log" CustomLog "logs/111.com-access_log" common</VirtualHost>
# Where 111.com is the domain for local access this time# To add more domains, copy the above code multiple times and modify the corresponding domainThen press esc, type :wq and enter to save.
Next modify the config file httpd.conf
vi /opt/lampp/etc/httpd.confChange
# Virtual hosts#Include etc/extra/httpd-vhosts.confTo
# Virtual hostsInclude etc/extra/httpd-vhosts.confThen restart Apache service
Modify local domain access, this time set 111.com as the local test domain
vi /etc/hostsAdd below
192.168.64.2 111.comDone, enter domain 111.com to access local directory