Devilbox: two projects

Viewed 447

It is a very simple newbie question but I can get my head around it.

I have my Devilbox working great with my project in /etc/hosts as 127.0.0.1 myproject.test in a folder called data/www/myproject.

Now I want to collaborate with a github project that has its own .env file and so on.

What should I do to have both projects in my Devilbox?

If I do:

127.0.0.1 myproject.test
127.0.0.1 secondproject.loc

And next to myproject folder I add a secondproject folder with a phpinfo.php, I can access myproject.test but secondproject.loc/phpinfo.php shows a 403 forbidden error.

I could consider having secondproject folder inside myproject folder but I don't know how to operate with the .env in secondproject.

Thanks!

1 Answers

Each project should have their own folder inside data/www.

So you have:

data/www/project1/htdocs
data/www/project2/htdocs

Then in your /etc/hosts your should have

127.0.0.1   project1.loc
127.0.0.1   project2.loc

Then if those two projects will work on different PHP versions what you can do and have two environment files with any name you want and before you do a docker-compose up --build -d you just rename the env file to .env and the container will load the configs for that project.

Now if you want to have them both running at the same time, then you need to enable both php versions at the same time and then use the ./shell.sh and configure each virtual host to use their own php version.

In your virtual hosts file you can add a directive to make it run with a specific php version like this:

<FilesMatch \.php$>
      SetHandler "proxy:unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost/"
</FilesMatch>

here we're saying that all .php files in this virtualhost should run with php 5.6. This might need some tweaks to get it to what you want.

Related