Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get virtual host to work with XAMPP?

I just reinstalled XAMPP on my Win 7 machine yesterday. I am working on a Laravel project. I installed the current version of Laravel and then I went to set up the virtual host on the local machine. When I go to the url I set up (jrd_dnd_tools.localhost) I get a Bad Gateway message If I go to localhost I get the site the url is supposed to go to. I've set up virtual hosts before but no idea why this is happening. I'm sure I am missing something stupid but can't figure out what.

httpd-vhosts.conf

<VirtualHost *:80>
     ServerAdmin webmaster@jrd_dnd_tools.localhost
     DocumentRoot "C:\Users\Joey\Web\jrd_dnd_tools/public"
     ServerName jrd_dnd_tools.localhost
     ServerAlias www.jrd_dnd_tools.localhost
     ErrorLog "logs/jrd_dnd_tools.localhost.log"
     CustomLog "logs/jrd_dnd_tools.localhost.log" common
     <Directory "C:\Users\Joey\Web\jrd_dnd_tools/public">
          AllowOverride All
          Order Allow,Deny
          Allow from all

          ## --New way of doing it
          Require all granted
     </Directory>
</VirtualHost>

.hosts

127.0.0.1       localhost
::1             localhost
::1             database.localhost
127.0.0.1       jrd_dnd_tools.localhost
like image 338
JoeyD473 Avatar asked Nov 08 '22 14:11

JoeyD473


1 Answers

What you have mistaken is *:80, for virtual hosts never use wildcards. Instead you can do jrd_dnd_tools.localhost. Here below is my virtual host setup, I did for demo.

And also notice directory separators I have in Document Root and directory.

Make these 2 changes and your virtual host will work like a charm.

<VirtualHost t.com:80>
    ServerAdmin [email protected]
     DocumentRoot "C:/xampp/htdocs/t"
     ServerName t.com
     ServerAlias t.com
     ## ErrorLog "logs/jrd_dnd_tools.localhost.log"
     ##CustomLog "logs/jrd_dnd_tools.localhost.log" common
     <Directory "C:/xampp/htdocs/t">
          AllowOverride All
          Order Allow,Deny
          Allow from all

          ## --New way of doing it
          Require all granted
     </Directory>
</VirtualHost>
like image 75
Chintan Kotadiya Avatar answered Nov 15 '22 06:11

Chintan Kotadiya