My Nextcloud is unreachable

I am trying to install Nextcloud on my VPS. I wrote a (human readable) script - not a shell script; I don’t know how to do that - but at one moment my Nextcloud is unreachable.

My ‘script’ is as follows:

apt-get -y update && apt-get -y upgrade
apt-get install -y apache2 libapache2-mod-php7.0 php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip mysql-server php-mysql letsencrypt python-letsencrypt-apache redis-server php-redis
mysql -u root -p

CREATE DATABASE nextcloud;
CREATE USER 'nc_user'@'localhost' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_user'@'localhost';
FLUSH PRIVILEGES;
\q

cd /var/www
wget https://download.nextcloud.com/server/releases/latest-12.tar.bz2 -O nextcloud-12-latest.tar.bz2
tar -xvjf nextcloud-12-latest.tar.bz2
rm nextcloud-12-latest.tar.bz2
rm -r html/
mv nextcloud/ html
mkdir /opt/nextcloud
chown -R www-data:www-data html
chown -R www-data:www-data /opt/nextcloud
nano /etc/apache2/sites-available/nextcloud.conf

Alias /nextcloud "/var/www"

<VirtualHost *:80>
	DocumentRoot "/var/www"
	ServerName my.domain.com

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/>
	Options +FollowSymlinks
	AllowOverride All

<IfModule mod_dav.c>
	Dav off
</IfModule>

SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
Satisfy Any

</Directory>

</VirtualHost>

nano /etc/php/7.0/apache2/php.ini
Add the file with the following lines:

opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

reboot

Go to http://my.domain.com
Enter the given values
After Nextcloud starts, logout

systemctl start redis-server
nano /var/www/html/config/config.php

Add above );

'session_lifetime' => 60 * 5,
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
 'host' => 'localhost',
 'port' => 6379,
 ),
	 
systemctl reload apache2
a2ensite nextcloud

(at this point my Nextcloud is unreachable)

Who can help me to find the error why my Nextcloud is not working anymore?

Kind regards,
Guido

FYI: I anonymized my script

Alias /nextcloud "/var/www"

<VirtualHost *:80>
	DocumentRoot "/var/www"
	ServerName my.domain.com

Shouldn’t this be:

Alias /nextcloud "/var/www/html/nextcloud"

<VirtualHost *:80>
	DocumentRoot "/var/www/html"
	ServerName my.domain.com

After enabling the nextcloud config in apache, you should start apache again. Check your apache logfiles (access and error) for messages.

You gave me the right hint. But I prefer to change these:
SetEnv HOME /var/www
SetEnv HTTP_HOME /var/www

because I want to make my Nextcloud accessible via http://domain.com and not http://domain.com/nextcloud.

Thanks for helping.

Kind regards,
Guido van Harten