user12989025
user12989025

Reputation:

Laravel - created virtual host, however website will not connect to localhost

I am desperate for help. I am new to mac and Laravel. I have just installed a fresh project and Laravel and i am trying to create the virtual host, my code:

httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot “/Applications/XAMPP/htdocs”
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot “/Applications/XAMPP/htdocs/learninghub/public”
ServerName learninghub.local
</VirtualHost>

hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
127.0.0.1   learninghub.local

Getting the following error -

Object not found! The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404 localhost Apache/2.4.41 (Unix) OpenSSL/1.1.1c PHP/7.3.9 mod_perl/2.0.8-dev Perl/v5.16.3

Any help is greatly appreciated.

Referring to homebrew

Error: Failure while executing; git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core exited with 128.

Upvotes: 0

Views: 3249

Answers (2)

Marcelo Z&#225;rate
Marcelo Z&#225;rate

Reputation: 296

Try with this:

<VirtualHost *:80> 
    DocumentRoot "/Applications/XAMPP/htdocs/learninghub/public"
    ServerName learninghub.local
    ServerAlias *.learninghub.local
    <Directory "/Applications/XAMPP/htdocs/learninghub/public">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Upvotes: 1

tamrat
tamrat

Reputation: 1915

If you are on a Mac, I would highly suggest using Laravel Valet instead. Its a very compact development environment that uses Nginx and dnsmasq to serve your local projects with pretty URLs (*.test).

With Valet, you really don't have to fiddle with virtual hosts or edit your hosts file. You just add the directory where your projects live to Valet, and it will automagically serve them.

Upvotes: 0

Related Questions