NextCloud and PHP-FPM as global alias issues

Discussion in 'Installation/Configuration' started by razor7, Aug 2, 2017.

  1. razor7

    razor7 Member

    Hi! Today I decided to test my NextCloud installation as a global alias with PHP-FPM. I currently have a working instance of NextCloud as alias on /var/www/cloud directory, using mod_php7, but I wanted to switch to PHP-FPM with no luck at all! jeje.

    My current specs are:
    • Ubuntu server 16.04
    • ISPConfig 3.1.6
    • Installed PHP Versions 5.6 - 7.0 and 7.1
    • NextCloud 12.0.0
    As I wanted to enable PHP-FPM with PHP 7.0, I created a PHP-FPM config file in /etc/php/7.0/fpm/pool.d with this config:
    Code:
    [cloud]
    
    listen = /var/lib/php7.0-fpm/cloud.sock
    listen.owner = www-data
    listen.group = www-data
    listen.mode = 0660
    
    user = www-data
    group = www-data
    
    pm = dynamic
    pm.max_children = 100
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 5
    pm.max_requests = 400
    
    env[HOSTNAME] = $HOSTNAME
    env[TMP] = /tmp
    env[TMPDIR] = /tmp
    env[TEMP] = /tmp
    env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    
    php_admin_value[open_basedir] = /tmp:/dev/urandom:/usr/share/php:/var/www/cloud:/var/www/clients/client1/web2/tmp/phplogs/
    php_admin_value[session.save_path] = /var/lib/php/sessions
    php_admin_value[upload_tmp_dir] = /tmp
    php_admin_value[sendmail_path] = "/usr/sbin/sendmail -t -i -f xxxx@xxxxxxxx.com.ar"
    
    After which I created an apache conf file in /etc/apache2/conf-available like this:
    Code:
    # cloud default Apache configuration
    Alias /cloud /var/www/cloud
    
    <Directory /var/www/cloud>
        Options +FollowSymLinks
        DirectoryIndex index.php
        AllowOverride All
        Require all granted
        Satisfy Any
    
        <IfModule mod_headers.c>
            Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
        </IfModule>
    
        <IfModule mod_dav.c>
           Dav off
        </IfModule>
    
        <IfModule mod_dav_fs.c>
           Dav off
        </IfModule>
    
        <IfModule mod_env.c>
            SetEnv HOME /var/www/cloud
            SetEnv HTTP_HOME /var/www/cloud
        </IfModule>
    
        <IfModule mpm_itk_module>
            AssignUserId www-data www-data
        </IfModule>
    </Directory>
    
    <IfModule mod_fastcgi.c>
        KeepAlive On
        KeepAliveTimeout 100
        MaxKeepAliveRequests 200
    
        <Directory /var/www/cloud>
            Require all granted
    
            <FilesMatch "\.php[345]?$">
                SetHandler php7-fcgi
            </FilesMatch>
        </Directory>
    
        <LocationMatch "/cloud/(fpm-ping|fpm-status)">
            HostnameLookups Off
            SetHandler php7-fcgi-virt
            Action php7-fcgi-virt /php7-fcgi virtual
        </LocationMatch>
    
        Action php7-fcgi /php7-fcgi virtual
        Alias /php7-fcgi /var/www/cloud/php7-fcgi-cloud
        FastCgiExternalServer /var/www/cloud/php7-fcgi-cloud -idle-timeout 300 -socket /var/lib/php7.0-fpm/cloud.sock -pass-header Authorization
    
    </IfModule>
    
    <IfModule mod_proxy_fcgi.c>
        <Directory /var/www/cloud>
            <FilesMatch "\.php[345]?$">
                SetHandler "proxy:unix:/var/lib/php7.0-fpm/cloud.sock|fcgi://localhost"
            </FilesMatch>
        </Directory>
    </IfModule>
    
    <IfModule mod_ssl.c>
        SSLUseStapling on
        SSLStaplingResponderTimeout 5
        SSLStaplingReturnResponderErrors off
        SSLStaplingCache shmcb:/var/run/ocsp(128000)
    </IfModule>
    This conf was already enabled because I had NextCloud running with this same apache conf file as mod_php7, so I just restarted php7.0-fpm and apache2 and seemed to be ok, no errors on restart...

    For testing purposes I created a test.php file with phpinfo(); inside and enabled fpm-ping and fpm-status locations so I can test the thing and the results are as follows:
    As you can see, I'm comletely lost here, because it seems to work, but NextCloud
    keeps loading forever.

    I have also tested with this simple chmod.php file, that is actually working on another virtual host of the same server with this code, but here fails, keeps loading for ever as nextcloud:
    Code:
    <?php
    
      function chmodDirectory( $path = '.', $level = 0 ) {
        $ignore = array( 'cgi-bin', '.', '..' );
          $dh = @opendir( $path );
          while( false !== ( $file = readdir( $dh ) ) ) { // Loop through the directory
              if( !in_array( $file, $ignore ) ) {
                  if( is_dir( "$path/$file" ) ) {
                      chmod("$path/$file",0755);
                      chmodDirectory( "$path/$file", ($level+1));
                  } else {
                      chmod("$path/$file",0644); // desired permission settings
                  }//elseif
              }//if in array
          }//while
        closedir( $dh );
      }//function
    
      chmodDirectory("./",0);
      echo("done");
    
    Thanks in advise!

    Apache error log:
     
    Last edited: Aug 3, 2017
  2. razor7

    razor7 Member

    [bump!]
     
  3. razor7

    razor7 Member

    [bump2!]

    UPDATE: Tried to install Joomla on the folder /var/www/cloud/joomla and it doesn't work either...
     
  4. ahrasis

    ahrasis Active Member

    Did you enable it (using its conf name) and mod_rewrite?
    Code:
    a2enconf cloud
    a2enmod rewrite
     
  5. razor7

    razor7 Member

    Hi @ahrasis ! Thanks yor your reply!
    cloud.conf is enabled and rewrite module is enabled too...
     

Share This Page