I get an `ngnix 403 Forbidden' when starting ddev
Asked Answered
N

3

10

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.

Nerte answered 7/7, 2018 at 22:25 Comment(1)
check your index.html file in /var/www/html/ directory.Tellurite
N
5

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.
Nerte answered 7/7, 2018 at 22:25 Comment(0)
D
3

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.

Dagger answered 30/3, 2022 at 8:25 Comment(1)
This is the right answer!! Always make sure to execute "ddev composer install" first! And then you can execute "ddev config"Cheatham
L
0

I don't know if you are running at #TYPO3 setup, but I had the same problem, and my problem was following.

"config": {
    "vendor-dir": ".Build/vendor",
    "bin-dir": ".Build/bin"
},

Having the vendor-dir and bin-dir in .Build wasn't working with the symlinks from the public folder.

I don't know if that could be the problem in your setup too.

Removing the ".Build/" from the vendor and bin-dir setup solved the problem for me.

File structure before the change:

$ typo3v7/public ls -la
drwxr-xr-x  6 <user> <group>  192 Jan 15 16:24 .
drwxr-xr-x  7 <user> <group>  224 Jan 15 16:02 ..
lrwxr-xr-x  1 <user> <group>   36 Jan 15 15:57 index.php -> ../.Build/vendor/typo3/cms/index.php
lrwxr-xr-x  1 <user> <group>   32 Jan 15 15:57 typo3 -> ../.Build/vendor/typo3/cms/typo3
drwxr-xr-x  4 <user> <group>  128 Jan 15 16:02 typo3conf
Lexicography answered 15/1, 2019 at 15:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.