14

I'm trying to install Laravel valet but I keep getting (when I visit domain.dev):

It works! 

I already tried a lot. For example:

remove valet 
stop apache (apachectl stop)
composer global require laravel/valet
valet install
valet restart

But that does not work for me. I've also installed Laravel Homestead in a vagrant box. Perhaps that has something to do with it? I can visit my Homestead sites.

How can I fix this problem?

Ben Swinburne
  • 25,669
  • 10
  • 69
  • 108
Jamie
  • 10,302
  • 32
  • 103
  • 186
  • "It works!" is the standard Apache page on OSX. You need to ensure you stop Apache running. – Ben Swinburne Sep 26 '16 at 17:10
  • If I exec `sudo apachectl -k stop` I receive the same message -_- – Jamie Sep 26 '16 at 17:47
  • Have a look at another answer I posted about this. It covers most points RE valet http://stackoverflow.com/a/37174256/769237 and might sort your issue. Having worked through that, let me know and I'll suggest other options – Ben Swinburne Sep 26 '16 at 23:26
  • Not working for me! – Jamie Sep 27 '16 at 15:49
  • What doesn't work? `sudo lsof -n -i:80 | grep LISTEN` will tell you what is listening on port 80. If you're still seeing "It works!", it's probably still Apache so you'll need to ensure that's stopped. – Ben Swinburne Sep 27 '16 at 15:51
  • @Jamie Try choosing an answer as correct if one of the answers below fixed your problem. – mesqueeb Feb 12 '18 at 01:49

3 Answers3

35

"It works!" will always be a message from Apache. Apache has to be turned off for Laravel Valet to work.

I see you have tried these before:

  • $ stop apache (apachectl stop)
  • $ sudo apachectl -k stop

I had the same problem. Try with the command below and then after be sure to restart valet again! This fixed it for me:

$ sudo apachectl stop
$ valet restart
mesqueeb
  • 5,277
  • 5
  • 44
  • 77
5

So many different combinations of what to do here

Here is what worked for me.

Turn off other local Apache altogether

sudo apachectl -k stop

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

Remove the Valet directory altogether

rm -r ~/.valet

Removed Valet via composer globally

composer global remove laravel/valet

Re-install via composer

composer global require laravel/valet

Install Valet

valet install

Go to Folder to Add directories

cd ~/Sites/

Then add projects to park

valet park

Change Valet domains to something else to stop urls forcing to https://

valet domain app

Change directory into the project folder

cd ./laravel-project/

Then open current project

valet open

The browser should open to http://laravel-project.app

mikoop
  • 1,981
  • 1
  • 18
  • 18
-3

No need to stop Apache, and it doesn't have anything to do with Homestead.

The answers provided solve your problem but they are not good.

You can simply run

valet port 8888

(or whatever port you want) and get your site on domain.dev:8888

The point is not that Apache and Nginx don't like each other, they are agnostic of each other, just keep them listening on different ports.

Paul Smalling
  • 131
  • 1
  • 8