Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change docroot in .env #206

Closed
johnwbaxter opened this issue Mar 9, 2018 · 14 comments
Closed

Change docroot in .env #206

johnwbaxter opened this issue Mar 9, 2018 · 14 comments
Assignees
Labels

Comments

@johnwbaxter
Copy link

johnwbaxter commented Mar 9, 2018

I am trying to change the docroot of an existing devilbox in the .env file.

The docs say to change the value and restart devilbox which i have done. (docker-compose down and then up)

I had: HTTPD_DOCROOT_DIR=public
I want: HTTPD_DOCROOT_DIR=deploy/public

I seem to get this error in the output which i don't normally:

httpd_1 | vhostgen: [2018-03-09 14:36:32] Adding: localhost
httpd_1 | sed: -e expression #1, char 31: unknown option to `s'
devilbox_httpd_1 exited with code 1

@cytopia
Copy link
Owner

cytopia commented Mar 10, 2018

@johnwbaxter good catch, this is indeed an error with sed. I will fix this in the container.

Looking at your special case, I think it can be done more easily.
Keep HTTPD_DOCROOT_DIR at the default (htodcs). and simply simlink htdocs to deploy/public.

Have a look at the CakePHP setup at step 4: https://github.com/cytopia/devilbox/blob/master/docs/Examples.md#21-setup-cakephp

Let me know if this resolves your problem for now.

@cytopia cytopia self-assigned this Mar 10, 2018
@cytopia cytopia added the bug label Mar 10, 2018
@johnwbaxter
Copy link
Author

Ha! I didn't think about a symlink! Nice, i'll do just that :) Thanks!!

@johnwbaxter
Copy link
Author

Hmm, not sure why, but my symlink isn't working here. Everything looks right, but, no luck. I'll just wait until you have a fix for this one and then go back to it.

@cytopia
Copy link
Owner

cytopia commented Mar 11, 2018

Hmm this should actually work as it is a standard feature and I do it all the time.

What OS are you on and can you also show me the symlink via ls -la and the error it throws when opening the project in the browser

@johnwbaxter
Copy link
Author

I'm on OSX.
ls -la gives me:
lrwxrwxrwx 1 devilbox devilbox 33 Mar 11 12:43 public -> site2018/webroot/deploy/public/

And the error it gives is:

403 Forbidden
nginx/1.12.1

@cytopia
Copy link
Owner

cytopia commented Mar 11, 2018

And site2018/webroot/deploy/public/ site is in the same directory as the public dir?

Also by default the docroot name must be htdocs, did you change that to public?

@johnwbaxter
Copy link
Author

I changed it to "public" in my .env originally so all projects use that folder name as the webroot.

See screenshot for the folder setup as that will explain better!
screen shot 2018-03-11 at 14 39 22

@cytopia
Copy link
Owner

cytopia commented Mar 11, 2018

Public needs to point to webroot/deploy/public/ and not to site2018/webroot/deploy/public/

@johnwbaxter
Copy link
Author

I have changed it to that and still get the same error.

I ran ls-ls and get:
lrwxrwxrwx 1 devilbox devilbox 22 Mar 11 14:47 public -> webroot/deploy/public/

It's ok, i'll change my setup for now. Thanks!

@cytopia
Copy link
Owner

cytopia commented Mar 11, 2018

OK, one other thing that I see just now. Looks like your symlink is inside a directory called public, remove that directory and create the symlink on the same level as the rest:

ls -la
lrwxrwxrwx 1 devilbox devilbox 22 Mar 11 14:47 public -> webroot/deploy/public/
drwxrwxrwx 1 devilbox devilbox 22 Mar 11 14:47 webroot                                                                          

@cytopia
Copy link
Owner

cytopia commented Mar 11, 2018

You should use symlinks for this kind of stuff, because changing HTTPD_DOCROOT_DIR will change it globally for ALL projects

@johnwbaxter
Copy link
Author

Yep, just caught that one myself!
All good now :D

Yep happy to use symlinks, but all my projects do follow the same directory structure, so it wouldn't have been an issue.

Thanks!!!!

@cytopia cytopia closed this as completed Mar 11, 2018
@johnwbaxter
Copy link
Author

Cool, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants