Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I get an `ngnix 403 Forbidden' when starting ddev

Tags:

ddev

After starting my ddev project and hitting it with the web browser I suddenly started getting `ngnix 403 Forbidden / directory index of "/var/www/html/" is forbidden' or just '403 Forbidden', and I can't figure out why. This worked earlier.

like image 912
rfay Avatar asked Jul 07 '18 22:07

rfay


2 Answers

This could mean that

  • Your project directory is not mounted
  • Or the project directory is mounted but there is no index.php or index.html in the docroot (or that the docroot is misconfigured, so to nginx and ddev it appears no index is available)

To find out if the project directory is mounted, use ddev ssh to go inside the web container, and use ls to see if the contents you see are what you should see in the docroot.

If there are no files there, then docker is having trouble mounting your project directory. This has been known to be caused by

  • Docker resources being stressed. You can increase docker's memory allotment from the default 2GB, or run less projects at once. (I generally ddev stop projects when I'm not actively working on them. That's completely nondestructive.)
  • In this issue it was found to be a firewall issue with Kaspersky.
like image 147
rfay Avatar answered Jan 01 '23 10:01

rfay


On my case, I run ddev config BEFORE doing a composer install, so no files were there. Initially that's not an issue, but it was that I mistakenly accepted the default configs from ddev, which missed that the web root was not the current path, but instead web folder

Another issue could be an error during composer install, where files like index.php were not deployed in the web folder.

like image 27
Alejandro Moreno Avatar answered Jan 01 '23 09:01

Alejandro Moreno