Question about webroot


I usually installs websites in the webroot (document root) directory public_html, most of them CMS’s like WordPress, Drupal, Spip, etc … I’m working on a new one based on Symfony which I also installed in public_html, but it is required that only the “public_html/web” subdirectory has to be reachable from the web (or accessible by Apache).
I more or less know how to achieve this when declaring a webhost “by hand” in the appropiate files, but I was wondering what was the best way to do this with Virtualmin ?

  • something like creating an alias from / to /web ? (I’m afraid this will prevent Apache from writing in top level cache dir …)
  • or maybe use the “Website documents sub-directory” that says “public_html” and replace it by “public_html/web” ?

It seems that the CMS still need to write into some first level directories (cache, tmp, …), so I am not so sure about what needs to be done …



Well, I suspect it it needs to write into a directory above the “web” directory, that it wouldn’t be making a web request to do that – it would be doing that by accessing the files/dirs directly, during an existing request.

That is to say – if you were to setup a redirect from / to /web, I think that would work just fine. Though I know that there are some who just change the DocumentRoot as well.

I believe either of those should work for you though.

Would you like a hand doing one of the above?



Sorry I didn’t get back to you earlier but this is an urgent project so I’m full steam on it :slight_smile: I will have to test this at the earliest tomorrow night so I will know soon enough if it works.
I will keep you posted of the results !