1、首先多站点:配置的路径不一样 也可以,配置新端口也可以。
在/Applications/XAMPP/xamppfiles/apache2/conf/httpd.conf 中,添加:
listen 8081
然后在/Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf中添加
<VirtualHost *:80> DocumentRoot "/Users/houzhibin/javaself/code/php/shop/crmeb3/public" <Directory "/Users/houzhibin/javaself/code/php/shop/crmeb3/public"> Options All AllowOverride All Order allow,deny Allow from all </Directory> ServerAlias crmeb3.demo.com ErrorLog "logs/dummy-host.example.com-error_log" CustomLog "logs/dummy-host.example.com-access_log" common </VirtualHost> <VirtualHost *:80> ServerName api.qiushi.com DocumentRoot "/Users/houzhibin/javaself/code/php/qiushi/public" <Directory "/Users/houzhibin/javaself/code/php/qiushi/public"> Options FollowSymLinks ExecCGI #是否显示列表 (在发布项目后一般是不启用,对于这个配置,针对DocumentRoot在apachede的默认文件夹外的目录生效 ) Options +indexes AllowOverride All Order allow,deny Allow from all #Deny from all Require all granted </Directory> </VirtualHost> <VirtualHost *:8081> DocumentRoot "/Users/houzhibin/javaself/code/php/qiushi/public" ServerAlias api.qiushi.com:8081 <Directory "/Users/houzhibin/javaself/code/php/qiushi/public"> Options FollowSymLinks ExecCGI #是否显示列表 403解决(在发布项目后一般是不启用,对于这个配置,针对DocumentRoot在apachede的默认文件夹外的目录生效 ) Options +indexes AllowOverride All Order allow,deny Allow from all #Deny from all Require all granted </Directory> ErrorLog "logs/api.qiushi.com-error_log" CustomLog "logs/api.qiushi.com.-access_log" common </VirtualHost>
好使了之后: