Mac 上 xampp 的虚拟主机

virtual host for xampp on Mac

在我的 macOS 10.15.4 上的 httpd-vhost.conf 中,



<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/"
    ServerName localhost

</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/theb/"
    ServerName theb.localhost
    ServerAlias www.theb.localhost
    #DirectoryIndex index.html
    <Directory "/Applications/XAMPP/xamppfiles/htdocs/theb">
        Require all granted              
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride none
    </Directory>
    ErrorLog "logs/theb.local-error_log"
</VirtualHost>

我也在httpd.conf

中包含了虚拟主机
Include etc/extra/httpd-vhosts.conf

然后在主机文件中,我有

127.0.0.1   localhost
127.0.0.1   www.theb.localhost

我现在面对这些配置的问题是,每当我在浏览器中浏览网站时,

http://www.theb.localhost, i will then be redirected to http://www.theb.localhost/dashboard(这是 xampp 默认项目文件夹)。我错过了什么吗??

  1. 重启阿帕奇。希望这会奏效。
  2. 如果您下载了 Xampp 的 VM 版本(已安装的那个),那么这将无法工作,因为它无法访问您的本地文件,请在此处获取非 VM 版本 https://sourceforge.net/projects/xampp/files/XAMPP%20Mac%20OS%20X/7.4.6/xampp-osx-7.4.6-0-installer.dmg/download