Search code examples
apachexamppvhosts

How to setup Virtual Host on XAMPP?


I'm using xampp v7.2.29.

But I can't setup a Virtual Host(vHost). Here is my code:

apache\conf\extra\httpd-vhosts.conf

    <VirtualHost *:80>
    ServerName localhost
    DocumentRoot "E:\xampp\htdocs"
    <Directory "E:\xampp\htdocs">
        Require all granted
    </Directory>
</VirtualHost>


<VirtualHost *:80>
    ServerName local.demoapp.com
    DocumentRoot "E:\xampp\htdocs\DemoApp"
    <Directory "E:\xampp\htdocs\DemoApp">
        Require all granted
    </Directory>
</VirtualHost>

C:\Windows\System32\drivers\etc\host

127.0.0.1       locl.demoapp.com

I'm using the above code but getting this error.

Click to s see error


Solution

  • You made a typo error on your host file.

    Since you used

    local.demoapp.com
    

    as your server name, your host file should be

    127.0.0.1    local.demoapp.com