Configuration

(1) Add the following in /etc/httpd/httpd.conf

<VirtualHost *:80>
  Protocols h2 h2c http/1.1
  <FilesMatch \.php$>
    # using pool /etc/php-fpm.d/nextcloud.conf. Port 9002 in SetHandler
    # must match with the one declared in /etc/php-fpm.d/nextcloud.conf
    SetHandler proxy:fcgi://127.0.0.1:9002
  </FilesMatch>

  ServerName nextcloud.localhost
  DocumentRoot /srv/httpd/htdocs/nextcloud

  <Directory "/srv/httpd/htdocs/nextcloud">
    Require all granted
    Options +FollowSymlinks +MultiViews
    AllowOverride All
    <IfModule mod_dav.c>
      Dav off
    </IfModule>
    SetEnv HOME      "/srv/httpd/htdocs/nextcloud"
    SetEnv HTTP_HOME "/srv/httpd/htdocs/nextcloud"
  </Directory>

  <IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
  </IfModule>
</VirtualHost>

You may need to add nextcloud.localhost to your /etc/hosts.
The nextcloud pool port is 9002. Be sure that it's not already engaged. In this case
modify it in your /etc/php-fpm.d/nextcloud.conf and in the VirtualHost definition in
step (1).

(2) Be sure that mod_rewrite and proxy_fcgi_module are enabled by uncommenting the
following lines in your /etc/httpd/httpd.conf

  LoadModule proxy_fcgi_module lib64/httpd/modules/mod_proxy_fcgi.so
  LoadModule rewrite_module lib64/httpd/modules/mod_rewrite.so

(3) Adjust the nextcloud pool config file /etc/php-fpm.d/nextcloud.conf to your
needs, then restart php-fpm and apache.

(4) Only in case you are upgrading a Nextcloud installation, add the missing
indexes to the database, otherwise proceed to step (5):

  sudo -u apache /srv/httpd/htdocs/nextcloud/occ db:add-missing-indices

If you get the following error

  "The current PHP memory limit is below the recommended value of 512MB."

raise the php memory limit in your /etc/php.ini:

  memory_limit = 512M

(5) You need to complete setup by visiting this page:

  http://nextcloud.localhost

or, if you prefer to install Nextcloud from command line, by running the following:

  sudo -u apache /srv/httpd/htdocs/nextcloud/occ maintenance:install 

(6) Continue the configuration following the instructions at

  https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/
