I get an `ngnix 403 Forbidden' when starting ddev

空扰寡人 提交于 2019-12-14 03:55:59

问题


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.


回答1:


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 rm 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.



回答2:


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


来源:https://stackoverflow.com/questions/51227365/i-get-an-ngnix-403-forbidden-when-starting-ddev

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!