asus
asus

Reputation: 1759

Virtual host will NOT work in MAMP but works on localhost:8888

Created a new Laravel project in htdocs in MAMP. Followed all the steps, added virtual hosts, changed conf file, etc/hosts, restarted mamp and my pc several times but I just can't get my virtual host to run.

however, when I am in the MAMP Dashboard I can navigate to my website -> website -> public and the default Laravel boilerplate page appears.

Has anyone had this issues with MAMP before? I gave up with XAMPP and Valet so it's my last chance here..

Specs High Sierra 10.13.5 on 2015 MBP, Composer version 1.6.5, php 7.2.7

httpd.conf

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

httpd-vhosts

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "Applications/MAMP/htdocs/website/public"
    ServerName website.dev
</VirtualHost>

etc/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
#255.255.255.255        broadcasthost
#::1             localhost

127.0.0.1 website.dev

Upvotes: 0

Views: 1061

Answers (1)

Souvik Ghosh
Souvik Ghosh

Reputation: 741

website.dev is technically a public url, so the browser is looking for it on the internet I guess. I was trapped once in this dreadful situation. changing the name to something like website.local should solve your issue. It did for me.

Upvotes: 1

Related Questions