Setting up a virtual host on XAMPP on Mac

后端 未结 3 1914
栀梦
栀梦 2021-02-06 15:34

I am trying to set up a virtualhost on my apple mac on localhost. The server is provided by XAMPP, which bundles Apache/MySQL/PHP in one bundle.

Here is what I have done

相关标签:
3条回答
  • 2021-02-06 15:56

    Have you told Apache to actually use name-based virtual hosting?

    # Use name-based virtual hosting.
    #
    NameVirtualHost *:80
    

    I don't believe it's enabled by default in Xampp on Mac.

    0 讨论(0)
  • 2021-02-06 16:03

    On xampp you need to edit 3 files to setup virtual hosts

    the /etc/hosts and /Applications/XAMPP/etc/extra/httpd-vhosts.conf as you did.

    But also you need to edit /Applications/XAMPP/xamppfiles/etc/httpd.conf to include the http-vhosts.conf

    make sure you have uncommented this line

    # Virtual hosts
    Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
    

    EDIT

    Have you tried to add this lines

    Order allow,deny
    Allow from all
    

    Just before the

    AllowOverride All
    
    0 讨论(0)
  • 2021-02-06 16:04

    Try leaving the the setting for "localhost" at the end of the file "httpd-vhosts.conf", i.e.:

    #
    # Virtual Hosts
    #
    ...
    
    # others vhost
    <VirtualHost *:80>
    ...
    </VirtualHost>
    
    # localhost
    <VirtualHost *:80>
        ServerName localhost
        DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
        <Directory "/Applications/XAMPP/xamppfiles/htdocs">
            Options Indexes FollowSymLinks Includes execCGI
            AllowOverride All
            Order Allow,Deny
            Allow From All
        </Directory>
    </VirtualHost>
    #end of httpd-vhosts.conf file
    

    Worked for me, greetings!

    0 讨论(0)
提交回复
热议问题