0

I have a web application that has the following directory structure:

/subdomain_name
    /app
    /public

This web application is installed for every new user in our VPS. They provide a subdomain name, and then a subdomain is generated, with the corresponding directory in the VPS where the web app will be stored. Every web app consists of two directories, app and public.

What I need is, for public to be, well, public, so that when the user types http://subdomain_name.ourdomain.com, the contents of public are shown to the user. At the same time, the app directory, which is on the same level as public, MUST NOT BE ACCESSIBLE to any user.

How would I go about this?

Keep in mind that the solution must be capable of being automated (every step done programmatically). I'm not asking for the automatization how-to, but the solution should be able to be executed programmatically for each web app installation, not just manually.

Additional info: Using Apache and cPanel.

EDIT for clarification: I'd like to be able to pull off a structure like the following:

/the hosting home directory
    /some_directory
    /some_other_directory
    /public_html
        [here goes ourdomain.com's index and such]
    /webapp_charles
        /app
        /public
    /webapp_fred
        /app
        /public
    /webapp_john
        /app
        /public

So, for example, user types http://webapp_charles.ourdomain.com into the browser and /[our hosting home]/webapp_charles/public is loaded. However, no visitor must be able to access /[our hosting home]/webapp_charles/app.

1 Answer 1

1

As the instructions for the web framework told you, you make the DocumentRoot the public directory.

7
  • That doesn't prevent people from accessing the webapp/app directory, considering it is in the same level as the webapp/public directory. Our VPS has a /public_html directory for our domain. If the web app is placed inside that public_html directory, both webapp/public AND webapp/app are exposed to visitors. If the webapp is placed at the same level as our domain's /public_html, or higher up, the whole thing is not accessible by visitors. Sep 8, 2013 at 17:10
  • I edited my original question to better reflect the directory structure desired. Sorry for not being too clear. Sep 8, 2013 at 17:18
  • I understood your question the first time, and this is still the answer. Sep 8, 2013 at 17:20
  • Sorry, maybe I'm missing something here. Changing the DocumentRoot to the public directory won't by itself make somesubdomain.ourdomain.com point to /[home folder]/somesubdomain/public. Sep 8, 2013 at 17:23
  • What I'm understanding is "in your web app code, change the document root to whatever you need". And that by itself won't achieve the desired effect. Are you referring to something else? Sep 8, 2013 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .