Search code examples
symfonyconfigurationpaneldocument-root

OpenPanel change the document root for an addon domain?


How to change the document root for an addon domain?

I have a VPS hosting several websites. I only want to change the document root for one of them, which is actually using the symfony 2, and points to the typical public_html folder. I want to change it in order to point to the the public_html/web/ folder instead.

Seems people is using their hosting control panel software to do so like Cpanel. unfortunately I have openpanel (http://www.openpanel.com/) and the options/capabilities of this latest are more limited. There is a way do so this even manually?


Solution

  • I've figured out that openpanel does not provide that posibility.

    So I had to do it manually.

    in the following folder:

    /etc/apache2/openpanel.d
    

    your domain (or subdomain -> we will take sub.domain.com as example) will have a specific config file:

    sub.domain.com.conf
    

    open it

    <VirtualHost *:80>
       DocumentRoot       /home/user/sites/sub.domain.com/public_html/
       ServerName         sub.domain.com
       <Directory /home/user/sites/sub.domain.com/public_html/>
       AllowOverride      All
       Allow from all
       </Directory>
       Include /etc/apache2/openpanel.d//sub.domain.com.inc/[^.#]*
       Include /etc/apache2/openpanel.d//global.inc
    </VirtualHost>
    

    change it to:

    <VirtualHost *:80>
       DocumentRoot       /home/user/sites/sub.domain.com/public_html/web/
       ServerName         sub.domain.com
       <Directory /home/user/sites/sub.domain.com/public_html/web>
       AllowOverride      All
       Allow from all
       </Directory>
       Include /etc/apache2/openpanel.d//sub.domain.com.inc/[^.#]*
       Include /etc/apache2/openpanel.d//global.inc
    </VirtualHost>
    

    Note that in the line I've added "/web/" in the line 2 and "/web" in the line 4