laravel / valet

A more enjoyable local development experience for Mac.
https://laravel.com/docs/valet
MIT License
2.5k stars 691 forks source link

[HARD] Valet 404 Not Found #333

Closed indreklasn closed 5 years ago

indreklasn commented 7 years ago

Hello

After three attempts trying to get Valet to work I'm turning here for help. Here is my setup:

img

img2

I even tried using configurating the .pow and it still does not work. Any clues? I killed my apache (free up port 80), reinstalled everything 3x times and yet not working.

Anyone smart enough to figure out why this is happening?

joshmanders commented 7 years ago

Did you make sure to restart the services? sudo brew services restart (nginx|php71)?

indreklasn commented 7 years ago

@joshmanders yes I tried that, does not fix.

drbyte commented 7 years ago

I've usually seen that if anything else was running on port 80 prior to installing valet then even killing the previous process might not be enough ... but a reboot magically solves it all. Strange I know, but has been the solution for several.

indreklasn commented 7 years ago

@drbyte http://d.pr/i/WmPF/23IzKuLy Here's my port 80 stuff. No apache running..tried rebooting, nothing works.

I'm pretty dried up on what might be causing this, thus the desperate issue.

huiyonghkw commented 7 years ago

I also encountered this problem, you can go to tracking problem as I thoughtEnter the user home directory /. Valet/Log

$ cd  /Users/chenghuiyong/.valet/Log

$ tail nginx-error.log
indreklasn commented 7 years ago

@bravist

The .log file is empty =(

tail
huiyonghkw commented 7 years ago

@wesharehoodies, try to reinstall the valet or your project

cchamikara commented 7 years ago

I have the same issue , I have even reinstall valet and stoped apache but still not working

indreklasn commented 7 years ago

Sorry, can't help, didn't get it to work properly. 😞

Rahulsharma0810 commented 7 years ago

Try with

valet uninstall valet install valet link brew services restart --all valet restart valet open

Best of Luck !

archy-bold commented 6 years ago

I'm having the same issues and none of the above works. There is another user on this machine who has Valet installed so could it be related to multiple users?

Rahulsharma0810 commented 6 years ago

If Valet installed on Separate users /home directory then there should should be no issue

archy-bold commented 6 years ago

There should be no issue, but there definitely is. I've now managed to get it working on my user account but it looks like the other user can only access my sites. Despite having their own ~/.valet folder and configuration. I guess the 404 comes from the fact that it's using another valet installation and can't find the requested project.

I tried restarting valet, the homebrew services and reinstalling on the other account. Nothing worked.

blu-towers commented 6 years ago

archy-bold is right having two users on the same machine both with Valet causes an absolute nightmare. I ended up deleting one user, chown all /usr/local folders back to main user then reinstalling brew services and valet.

I still had problems ping test.dev not found. Turns out /usr/local/etc/dnsmasq.conf had references to my old users dnsmasq.conf file deleting this now all working. I think this conf file may have contributed to the 404 issue to start with but i can't be sure.

Found this info on https://stackoverflow.com/questions/37172691/valet-laravel-dns-address-can-not-be-found

rickvdl commented 6 years ago

Having the same issue with multiple users, can't seem to figure it out.

jeffreyroberts commented 6 years ago

I am having this issue for a CakePHP 3 application

I did valet park in the parent folder of the application and I am getting

screen shot 2017-10-20 at 7 57 53 pm

However, it does work for a laravel application, I am wondering if this is a driver issue, maybe the driver needs to be specified somewhere?

ghost commented 6 years ago

I had the same issue, tried every single solution above, without success. PHP 7.1, High Sierra I solved by unlinking all domains and very important: cd parent/my-project && valet link my-project. Before that, I did cd parent && valet link my-project which was wrong. Use valet links to monitor your actual paths

dpatey commented 6 years ago

@alexgiuvara Thank you. The link issue was what causing my 404s.

Ahmed3rab commented 6 years ago

If anyone is still having an issue, I just had this issue with Craft3, what I did is I went to the web folder inside the root folder of the craft project, ran valet link .<test/dev> and it worked. my entry was valet link craft, since my only domain was test, so valet automatically set the url to craft.test

tomazcp commented 6 years ago

@alexgiuvara thanks mate your linking tip solved it for me.

cdils commented 6 years ago

@alexgiuvara Thank you! Solves my problem. I'll add this here to be more explicit in case it helps someone else. If you've previously run: cd parent && valet link my-project then do cd parent && valet unlink my-project. That'll clean up previous, incorrect link and then run cd parent/my-project && valet link my-project per @alexgiuvaras's tip.

Mayvis commented 5 years ago

Try valet links to see your project path, and valet link again.

manhlinhng commented 5 years ago

Yep. I had issue on Mojave. You can unlink your project wrong link path project. Example: Park path: path_to/projects and project path path_to/projects/laravel Step by step

  1. Unlink project (laravel) wrong path. cd projects valet unlink laravel
  2. Go to your project (laravel) and create new link cd path_to/project/laravel valet link laravel valet restart

DONE.

drbyte commented 5 years ago

I believe this issue can be closed.

It discusses 3 things, all of which are closed:

  1. Valet giving 404 because of port conflicts, which is a userland issue.
  2. Valet giving 404 in a multi-user environment, which is not supported by valet.
  3. Valet giving 404 because project was linked to wrong location, which is exactly by design.
ligne13 commented 5 years ago

I also found that if you prefix your site domain with "www." it may not work. For example : www.mysite.test does not work, but mysite.test does.

Anyway, I think valet automatically handles the www subdomain when creating a site.

bedus-creation commented 4 years ago

I got the same problem and solved by.. cd ~/.composer/

sudo chown -R $(whoami) vendor

drbyte commented 4 years ago

I got the same problem and solved by.. cd ~/.composer/

sudo chown -R $(whoami) vendor

Or even better:

sudo rm -rf ~/.composer/vendor
composer global update

(I say "better" because if you've got a mishmash of permissions problems in that directory, then you've probably also got other problems, and clearing it all and reinstalling stuff is more thorough.)

Ahmed-Aboud commented 4 years ago

if you are trying to link normal php folders ( no framework ) you must specify the file and the file ending example :http://phpinfo.localhost/info.php

wakjoko commented 4 years ago

please rename your project if it contains underscore. i found it the hard way though.. hope this will help someone else.

example project name: my_project rename it to: my-project

valet unlink my_project
valet link my-project
musafir928 commented 4 years ago

-> cd path/to/your/project/folder -> valet link

RichardFisher8410 commented 3 years ago

cd into your project folder. In my case this was the folder that contained all my WordPress files and folders (root of my website) and run "valet link". I tried other ways, but this was the only one that worked for me.

dima2306 commented 3 years ago

please rename your project if it contains underscore. i found it the hard way though.. hope this will help someone else.

example project name: my_project rename it to: my-project

valet unlink my_project
valet link my-project

Thanks for the notice. _ is really a problem.

I've just renamed project name in the Nginx configuration, certificates issued for it, symlink in .valet/Sites. So actually where the project is located /var/www/project_name is with an underscore, but elsewhere name is merged. valet:links gives

+-------------+-----+--------------------------+-------------------------+
| Site        | SSL | URL                      | Path                    |
+-------------+-----+--------------------------+-------------------------+
| projectname |     | http://projectname.test  | /var/www/project_name   |
+-------------+-----+--------------------------+-------------------------+

And it's working!

fjobeir commented 1 year ago

use valet links to check the registered links I had that issue, my mistake was so funny, I simply had the following folder structure: sites -> project. under the project folder, I have the api folder and front folder.

I had to apply link on the api, but I was applying it on the project folder. valet links helped me discover the problem.

The linked directory should have an index, having it exists with sub folder(s) is not enough

solamichealolawale commented 1 year ago

In my own case (Vanilla PHP project), public folder was the cause of my issue.

Inside my project folder, I have a public folder that houses all my assets.

Turns out the valet driver checks inside the public folder for index.php which makes sense because that's how Laravel is configured.

So I had to rename the public folder that house all my assets to assets.

You can rename it to whatever you want.

uaibo commented 11 months ago

I got the same problem and solved by.. cd ~/.composer/

sudo chown -R $(whoami) vendor

this is the only solution from here that worked for me. I had tried park/unpark, link/unlink, secure/unsecure, reinstall, restart, everything else in the book. Only setting these proper permissions fixed it for me. I have a similar problem in another laptop so will try there too. Thanks a lot.

chrisgrim commented 5 months ago

For those of you who are having this issue because of multiple Users. This solution solved it for me:

Create a Sites directory in the second user account at /Users/username/Sites and put my sites into that, then just head back to my main (admin) account where Valet is installed and run...

$ cd /Users/username/Sites $ valet park ... and I can now access any websites I park in that folder.

aimahdi commented 5 months ago
composer global update

Finally I have

In my own case (Vanilla PHP project), public folder was the cause of my issue.

Inside my project folder, I have a public folder that houses all my assets.

Turns out the valet driver checks inside the public folder for index.php which makes sense because that's how Laravel is configured.

So I had to rename the public folder that house all my assets to assets.

You can rename it to whatever you want.

Finally, I have resolved this. Thank you so much. My project was running and suddenly I went to share my project using valet share. I am assuming it creates a conflict with public folder available on my project.