phplaravellaravel-valetvalet

Laravel Valet 403 forbidden


I am having issues with setting up Laravel Valet on my machine (MacOS Mojave 10.14). I followed the official documentation on Laravel documentation site. I have installed Valet, added Composer to path, I can run valet and laravel commands from anywhere in the system so that works. I have mapped my project folder with valet park. I can also do a ping on any *.test domain and it returns 127.0.0.1 responses.

I have created a new project laravel new blog within that directory and when accessing http://blog.test I am getting nginx 403 forbidden response.

I suspect something may conflict maybe so I tried these steps, none of which worked:

  1. Added explicitly both blog and blog/public to valet link blog and valet link blog2. Accessing blog.test and blog2.test both return forbidden
  2. Killing Apache with sudo apachectl stop returns:

/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service

  1. sudo killall httpd returns:

No matching processes were found

  1. Uninstalling nginx and running valet install again didn't help.

  2. Running sudo nginx returns:

nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

nginx: [emerg] still could not bind()


NOTE: I do have a Docker running on my machine


Solution

  • I have found Docker to be the issue. I already had an app running on port 80 so it was preventing nginx from starting. I shut down the container and run sudo nginx and it solved the issue.