Results 1 to 5 of 5

Thread: Howto: Run multiple websites (users) from one docroot

  1. #1
    Join Date
    Jun 2016

    Howto: Run multiple websites (users) from one docroot

    Weve build a web application which must serve different domains. At the moment we are using domain pointers (with alias) and this works fine. The thing is we want to be able to attach different SSL certificates to the domains, want to keep resources per user and also be able to manage DNS. What Ive tried is the following:

    Added a new user of one of the domains, F.E.

    In custom HTTPD I added the following for

    |*if SSL_TEMPLATE="1"|

    These docroot is from the base domain. At the moment this does not work, I get the following error:

    Mismatch between target UID (1004) and UID (1002) of file "/home/user/domains/"

    This is of course right but I try to find a way to solve this.

    I matched PHP versions for and

    Our server uses apache/2 with Cloudlinux with fastcgi configured in DA.

    Any ideas?

  2. #2
    Join Date
    Jun 2016
    Hi Alex, thx for your reply. I do not really understand what you mean by mount --bind , could you explain? And maybe you have other thoughts? What I would like is:

    - Have one domain for our codebase (
    - Have multiple users the use the same codebase but with own domain
    - Separate SSL certificates
    - DNS per domain
    - Resources per user

    Basically that comes down to domain pointers (alias) but then without the shared resources of one user.

  3. #3
    Join Date
    Jun 2019
    If you are wanting to use different certificates for the domain names, but both point to the same DocumentRoot, perhaps you would be better off creating the newdomain as a domain under the user panel (not as a domain pointer).

    This will create a separate VirtualHost for newdomain separate from basedomain.

    This will also create a separate directory for newdomain to use as DocumentRoot:


    But if you want this to be the same as


    Couldn't you just delete /home/user/domains/ and set up /home/user/domains/ as a symlink to /home/user/domains/

    rm -rf /home/user/domains/
    ln -s /home/user/domains/ /home/user/domains/

    (As always, be careful with rm -rf as this is going to delete the entire /home/user/domains/ directory, I'm assuming it's empty, but if it's not or if there is something in there that you want to keep, don't run this command without moving those files out of the directory structure first)

    Now you would have a VirtualHost to install a certificate on for and a VirtualHost to install a certificate for - but they would both draw their content from /home/user/domains/

    (This is why I don't like "domain pointers" or "domain aliases")

  4. #4
    Join Date
    Jun 2016
    @sparek. Thank you for your reply and ideas. I've tried this but I get the message: Forbidden - You don't have permission to access / on this server.

    The server log for newdomain says:
    AH00037: Symbolic link not allowed or link target not accessible: /home/user/domains/

    I think this has to do with user:group rights. Since the new user tries to access scripts from another user:group

    If you have any further ideas, please let me know.

  5. #5
    Join Date
    Jun 2019
    Unfortunately it's not immediately clear what specifically you are doing.

    Quote Originally Posted by anton1982 View Post
    Weve build a web application which must serve different domains.
    Where is this application hosted? What file-system path on the server is this code stored at?

    For example, if this is being stored under the path:


    Then perhaps you just need to create a rewrite.

    <Location /mywebapp>
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{SERVER_PORT} ^80$ [OR]
    RewriteCond %{REQUEST_URI} ^/mywebapp
    RewriteRule ^ https://%THESERVERSHOSTNAME%/mywebapp [R=302,L]

    (Replace %THESERVERSHOSTNAME% with the actual server's hostname... or the domain name for whatever account is hosting this application on the server)

    Within one of the Apache include files (perhaps /etc/httpd/conf/extra/httpd-alias.conf).

    This way when any domain name that resolves to the server ( uses a URL structure like - they get redirected to https://%THESERVERSHOSTNAME%/mywebapp

    This alleviates the need for every to have to have it's own secure certificate. And it insures that the application is executed under the correct user owner.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts