Die Konfiguration von Apache2 für eine Nextcloud Instanz

Im folgenden wird eine HTTPS Konfiguration für einen Aapache2 Webserver aufgezeigt:

Zeilen welche mit „# PLEASE CHANGE“ enden, müssen bearbeitet werden!

/etc/{apache2/httpd}/conf.d/nextcloud.conf

<VirtualHost *:443>
        SSLEngine on
        DocumentRoot /var/www/nextcloud/
        ServerName nextcloud.nikomax.de # PLEASE CHANGE
        Protocols http/1.1
        LoadModule remoteip_module modules/mod_remoteip.so
        RemoteIPHeader X-Forwarded-For
        RemoteIPTrustedProxy 10.0.10.1 # PLEASE CHANGE
        Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
        #Header edit Set-Cookie ^(.*)$ "$1;HttpOnly;Secure;SameSite=Strict"
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
                SetHandler proxy:fcgi://php-fpm
        </FilesMatch>
        <Proxy "unix:/run/php-fpm/www.sock|fcgi://php-fpm">
        # we must declare a parameter in here (doesn't matter which) or
        # it'll not register the proxy ahead of time
        ProxySet disablereuse=off
        # Note: If you configure php-fpm to use the "pm = ondemand"
        #then use "ProxySet disablereuse=on"
        </Proxy>
        #Alias /nextcloud "/var/www/nextcloud/"
        ProxyPass /push/ws ws://127.0.0.1:7867/ws
        ProxyPass /push/ http://127.0.0.1:7867/
        ProxyPassReverse /push/ http://127.0.0.1:7867/
        <Directory /var/www/nextcloud/>
                Options +FollowSymlinks
                AllowOverride All
                Require all granted
                <IfModule mod_dav.c>
                        Dav off
                </IfModule>
                SetEnv HOME /var/www/nextcloud
                SetEnv HTTP_HOME /var/www/nextcloud
        </Directory>
        ErrorLog /var/log/httpd/nextcloud_error.log
        CustomLog /var/log/httpd/nextcloud_access.log combined
        # ServerAlias nextcloud.bitbone.de **# PLEASE CHANGE and UNCOMMENT IF NEEDED**
        SSLCertificateFile /etc/pki/tls/certs/nextcloud.crt
        SSLCertificateKeyFile /etc/pki/tls/private/nextcloud.key
</VirtualHost>

Falls nur diese Konfiguration vorgenommen wird, ist der Server nur per HTTPS erreichbar. Das heißt eine unverschlüsselte Verbindung per HTTP wird auf der Standard-Apache2 Seite landen oder gar nichts anzeigen!