Mount CMS dir for all clients

Discussion in 'Installation/Configuration' started by GDI-007, Jul 8, 2021.

  1. GDI-007

    GDI-007 New Member

    I have a typical install of ISPConfig 3, on Ubuntu 20.04, on my test VPS.
    Other conf.: Apache, PHP (Fast-CGI or PHP-FPM, all the same can be the same), SuExec enabled.
    a) How to mount "/var/www/cms/" folder for all clients? :rolleyes:
    b) and how can this be automated? When I create a site 3, 4, 5... for different clients (then I will use an API or script).
    c) Is it enough to use "PHP open_basedir" (on Panel > Sites > Web Domain > Options page)?
    THX ALL! :)
  2. GDI-007

    GDI-007 New Member
  3. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    I'm not clear what you're trying to accomplish, so no idea if there are better options, but to answer your question, you could use a bind mount to make a directory available inside client jails, and that could be automated by using an ispconfig server plugin to manage /etc/fatab and perform the initial mount.
  4. GDI-007

    GDI-007 New Member

    Thank you for your response! I tried mount but the php programs in the external folder cannot be run from the web.
    The server would have one CMS core.
    (My TIPP: Maybe suPHP or permission problem.)
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    suPHP is not used anymore for many years, I hope you did not try to activate this ancient and slow technology on your server as it's disabled by default for good reasons. Use PHP mode php-fpm with suexec enabled. If this does not work, then you can try disabling suexec in the website settings, this will make the web server run the PHP scripts as www-data user or HTTP user. depending on the Linux distribution. That's less secure as all sites can access files from other sites, but it might be necessary in your special case.

    Personally, I won't do such a setup that you try to set up and use a secure setup instead with an automatic mechanism to update the core components in the sites when needed instead of using a central core component directory.
  6. GDI-007

    GDI-007 New Member

    Thanks for your time & answers.
    I'm experimenting with a test VPS for now, not live.
    I switched to: php-fpm + suexec.
    For now, I copy the core several times / and sometimes update everything.
  7. GDI-007

    GDI-007 New Member

    It works on my test VPS!
    I created the "/var/www/clients/cms/" folder, via FTP.
    I set chmod 755 on it, via SSH.
    & I add "/var/www/clients/cms/:" to "PHP open_basedir" (ISPConfig>Sites>Web Domain>Options) on the client2/web2 account and some websites.

    The first test is promising:
    /var/www/clients/cms/cmsfunc1.php code:

    function cmsfunc1() {
      print "Hello CMS!";
    /var/www/clients/client2/web2/test.php code:
    cmsfunc1(); //Print to HTML output: Hello CMS!
    $bRet1 file_put_contents('/var/www/clients/cms/cmshack.php''my file!');
    var_dump($bRet1); //Return value: false
    $bRet2 file_put_contents(__DIR__ '/local.php''my file!');
    var_dump($bRet2); //Return value: true
    v0.0.1b ;-)

    Do you think the direction is good (and can be improved with a little learning), or should I forget?
    I thank any constructive response.

    I have been creating websites for a long time, and I studying the server side.
    Sorry, my English is not good, but I'm persistent :)

Share This Page