I'm having trouble deploying a project:

My web hoster automatically generates vhosts for each domain, with their respective webroot being /var/www/myuser/mydomain.com/; so I followed the Moving Craft’s Files Below the Webroot (https://craftcms.com/knowledge-base/moving-craft-files) approach.

I got everything working so far, except craft now seems to be confused about its @webroot path: according to /admin/utilities/system-report it is /var/www/myuser/mydomain.com/app/web when in fact it should be /var/www/myuser/mydomain.com.

I tried explicitly setting CRAFT_WEB_ROOT="/var/www/myuser/mydomain.com" in the .env file, but it doesn't seem to get picked up (despite @dotenv pointing to the correct file).

Additional observations:

  • /admin/assets sees and lists all the files in /var/www/myuser/mydomain.com/uploads
    • new uploads however are saved to /var/www/myuser/mydomain.com/app/web/uploads
  • /admin/utilities/asset-indexes does NOT seem to be aware of the files and warns me about them missing
  • on the frontend: all calls to /actions/assets/generate-transform?transformId=X fail with a 500 error

Any ideas what the missing piece might be?

  • 2
    Move to a different web hosting service. Not being able to use a subdirectory as the webroot is a non-starter. It's not worth it to spend time building a worse, insecure setup to accommodate a bad hosting service.
    – MoritzLost
    Dec 19, 2023 at 13:02


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.