如何将ddev php容器的文档根路径从/var/www/html更改为其他路径?

huangapple go评论51阅读模式
英文:

How to change ddev php container docroot path from /var/www/html

问题

我需要更改ddev在php容器中设置的文档根路径,因为我的代码源中已经有一个html文件夹,并且自定义的包含路径确定不起作用。

代码会查找html的第一个出现位置以设置包含文件的路径到另一个位置。但是因为代码和ddev php容器都有html,路径中现在有两个html的出现,所以代码现在形成了不正确的路径。这是旧代码,这个例程在代码中多次执行,所以我宁愿不更改每个文件以避免更大的拉取请求差异。

我想将它从/var/www/html/更改为/var/www/

请您给予建议。

英文:

I need to change the docroot path that ddev sets up in the php container because I have some code that has already had an html folder in its source and bespoke include path determination is not working.

The code looks for the first occurrence of html to set a path to include files at another location. But because both the code and ddev php container have html, there are 2 occurrences of html in the path and the code now forms the path incorrectly. It's legacy code and the routine is done many times in the code so I'd rather not change each file to avoid larger pull request diffs.

I would like to change it from /var/www/html/ to /var/www/

Please can you advise.

答案1

得分: 1

我不建议这样做,但你可能只需在 docker-compose.mounts.yaml 中添加另一个挂载点:

services:
  web:
    volumes:
    - ../:/var/something

使用 /var/www 会导致很多问题,因为它会引起重叠。

更多细节请查看 https://ddev.readthedocs.io/en/latest/users/extend/custom-compose-files/

英文:

I don't recommend this, but you can probably just add another mount in a docker-compose.mounts.yaml

services:
  web:
    volumes:
    - ../:/var/something

Using /var/www will cause much pain because it will cause an overlap.

More detail in https://ddev.readthedocs.io/en/latest/users/extend/custom-compose-files/

huangapple
  • 本文由 发表于 2023年7月3日 17:19:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76603421.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定