简体   繁体   English

使用laradock docker配置进行开发

[英]Using laradock docker configuration for developing

Hello there we am currently developing a Laravel application. 你好我们正在开发一个Laravel应用程序。 I want all my team members to work locally so we decided to use Docker for our local development environment. 我希望我的所有团队成员都能在本地工作,所以我们决定将Docker用于我们的本地开发环境。 I did a little research and there is a project called laradock. 我做了一点研究,有一个名为laradock的项目。 After installing it I am supposed to go to http://localhost and the project should run. 安装后我应该去http:// localhost ,项目应该运行。 But I get this: 但我明白了: 在此输入图像描述

I am using apache2 and mysql 我正在使用apache2和mysql

Check you apache configuration (in my case [laradock_folder]/apache2/sites/default.apache.conf file). 检查你的apache配置(在我的案例中[laradock_folder]/apache2/sites/default.apache.conf文件)。

You should have DocumentRoot /var/www/public/ . 你应该有DocumentRoot /var/www/public/ I suppose you have /var/www/ instead 我想你有/var/www/而不是

tl;dr TL;博士

Go to ./laradock/.env and search for APACHE_DOCUMENT_ROOT then edit that line to this: 转到./laradock/.env并搜索APACHE_DOCUMENT_ROOT然后将该行编辑为:

APACHE_DOCUMENT_ROOT=/var/www/public

Things to do after the change 改变后要做的事情

For this change to take effect, you have to: 要使此更改生效,您必须:

  • Rebuild the container: docker-compose build apache2 重建容器: docker-compose build apache2
  • Restart the containers: docker-compose up 重启容器: docker-compose up

Explanation 说明

As mentioned by simonvomeyser on GitHub this is a recent addition which had the same effect as rodion.arr's solution but this way you can leave the original config files untouched and use the .env file to store all your project related configurations. 正如simonvomeyser在GitHub上所提到的,这是最近添加的,与rodion.arr的解决方案具有相同的效果,但这样您可以保持原始配置文件不变,并使用.env文件来存储所有与项目相关的配置。 Obviously, since this is a docker config change, you have to rebuild and restart your container, as rodion-arr and 9bits ponted it out in the same thread. 显然,由于这是一个docker配置更改,你必须重建并重新启动你的容器,因为rodion-arr9bits在同一个线程中进行了调整。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM