Next cloud internal server error

Hello All,
I am new to the Linux environment and to learn I bought a Raspberry Pi 3.

Next cloud amazed me about the fact that personal files can be personal. So I setup the nextcloud server following the steps mentioned here

All went well and I was able to access the site via port 80 but when upgrading to SSL I get an error
“Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the webserver log.”

Would appreciate if anybody can help me setup the server.

Could you please post logfile from Apache webserver?

I am very new to Linux environment. Can you guide me how to retrieve the log.

I am not familiar with Apache but check /var/log/apache or /var/log/apache2. Ther should be logfiles in it like “access.log”.

I don’t know the command for that. i tried cd /var/log/apache2 but that did not work

cd /var/log
ls -alF

What is the output?

pi@raspberrypi:/var/log $ ls -alF
total 688
drwxr-xr-x  6 root root   4096 Jan 31 08:24 ./
drwxr-xr-x 12 root root   4096 Jan 31 08:24 ../
-rw-r--r--  1 root root   2148 Jan 31 08:26 alternatives.log
drwxr-x---  2 root adm    4096 Jan 31 08:25 apache2/
drwxr-xr-x  2 root root   4096 Jan 31 08:25 apt/
-rw-r-----  1 root adm   18809 Jan 31 09:32 auth.log
-rw-r--r--  1 root root    457 Jan 31 08:20 boot.log
-rw-r--r--  1 root root      0 Nov 13 04:10 bootstrap.log
-rw-------  1 root utmp   1152 Jan 31 09:26 btmp
-rw-r-----  1 root adm  111673 Jan 31 09:29 daemon.log
-rw-r-----  1 root adm   49684 Jan 31 08:26 debug
-rw-r--r--  1 root root 118444 Jan 31 08:26 dpkg.log
-rw-r--r--  1 root root      0 Nov 13 04:10 faillog
-rw-r--r--  1 root root      0 Nov 13 04:10 fontconfig.log
-rw-r-----  1 root adm   60522 Jan 31 08:20 kern.log
-rw-rw-r--  1 root utmp 292292 Jan 31 09:26 lastlog
drwx--x--x  2 root root   4096 Jan 31 08:20 lightdm/
-rw-r-----  1 root adm   60388 Jan 31 08:25 messages
drwxr-x---  2 root adm    4096 Aug 13 11:49 samba/
-rw-r-----  1 root adm  177478 Jan 31 09:29 syslog
-rw-r-----  1 root adm    3814 Jan 31 08:25 user.log
-rw-rw-r--  1 root utmp   5760 Jan 31 09:26 wtmp
-rw-r--r--  1 root root  11675 Jan 31 08:20 Xorg.0.log
-rw-r--r--  1 root root  11876 Jan 31 08:20 Xorg.0.log.old

i’ve reinstalled raspberypi and ran all the commands again. i get this error when restarting the apache service

Job for apache2.service failed because the control process exited with error code.
See “systemctl status apache2.service” and “journalctl -xe” for details.

when check the status of the service

● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-01-31 09:51:30 HST; 38s ago
Process: 1003 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Jan 31 09:51:30 raspberrypi systemd[1]: Starting The Apache HTTP Server…
Jan 31 09:51:30 raspberrypi apachectl[1003]: AH00526: Syntax error on line 33 of /etc/apache2/sites-enabled/default-ssl.conf:
Jan 31 09:51:30 raspberrypi apachectl[1003]: SSLCertificateKeyFile: file ‘/etc/apache/ssl/apache.key’ does not exist or is empty
Jan 31 09:51:30 raspberrypi apachectl[1003]: Action ‘start’ failed.
Jan 31 09:51:30 raspberrypi apachectl[1003]: The Apache error log may have more information.
Jan 31 09:51:30 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited status=1
Jan 31 09:51:30 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
Jan 31 09:51:30 raspberrypi systemd[1]: apache2.service: Unit entered failed state.
Jan 31 09:51:30 raspberrypi systemd[1]: apache2.service: Failed with result ‘exit-code’.

here is the log from /var/log/apache2

[Thu Jan 31 08:25:09.406037 2019] [mpm_event:notice] [pid 1730:tid 1995976704] AH00489: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:25:09.408833 2019] [core:notice] [pid 1730:tid 1995976704] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 08:26:40.560322 2019] [mpm_event:notice] [pid 1730:tid 1995976704] AH00491: caught SIGTERM, shutting down
[Thu Jan 31 08:26:40.724291 2019] [mpm_prefork:notice] [pid 11892] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:26:40.724703 2019] [core:notice] [pid 11892] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 08:26:41.655317 2019] [mpm_prefork:notice] [pid 11892] AH00169: caught SIGTERM, shutting down
[Thu Jan 31 08:26:42.261394 2019] [mpm_prefork:notice] [pid 11949] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:26:42.261823 2019] [core:notice] [pid 11949] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 08:27:02.244094 2019] [mpm_prefork:notice] [pid 11949] AH00169: caught SIGTERM, shutting down
[Thu Jan 31 08:27:02.555111 2019] [mpm_prefork:notice] [pid 11997] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:27:02.555328 2019] [core:notice] [pid 11997] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 08:34:28.018230 2019] [:error] [pid 12071] [client 192.168.100.34:4019] creating sqlite db
[Thu Jan 31 08:50:28.222485 2019] [:error] [pid 12003] [client 192.168.100.34:22696] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [14] unable to open database file in /var/www/html/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(992): OC\DB\Connection->connect()\n#1 /var/www/html/nextcloud/lib/private/DB/Connection.php(216): Doctrine\DBAL\Connection->executeUpdate(‘PRAGMA read_unc…’, Array, Array)\n#2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): OC\DB\Connection->executeUpdate(‘PRAGMA read_unc…’)\n#3 /var/www/html/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)\n#4 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOSqlite\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))\n#5 /var/www/html/nextcloud/lib in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 64
[Thu Jan 31 08:50:28.225343 2019] [:error] [pid 12003] [client 192.168.100.34:22696] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [14] unable to open database file in /var/www/html/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(992): OC\DB\Connection->connect()\n#1 /var/www/html/nextcloud/lib/private/DB/Connection.php(216): Doctrine\DBAL\Connection->executeUpdate(‘PRAGMA read_unc…’, Array, Array)\n#2 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): OC\DB\Connection->executeUpdate(‘PRAGMA read_unc…’)\n#3 /var/www/html/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)\n#4 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOSqlite\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))\n#5 /var/www/html/nextcloud/lib in /var/www/html/nextcloud/lib/private/DB/Connection.php on line 64
[Thu Jan 31 08:52:14.122071 2019] [mpm_prefork:notice] [pid 11997] AH00169: caught SIGTERM, shutting down
[Thu Jan 31 08:52:14.461543 2019] [mpm_prefork:notice] [pid 12332] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 08:52:14.461805 2019] [core:notice] [pid 12332] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 09:22:09.636083 2019] [mpm_prefork:notice] [pid 12332] AH00169: caught SIGTERM, shutting down
[Thu Jan 31 09:22:09.951096 2019] [mpm_prefork:notice] [pid 12610] AH00163: Apache/2.4.25 (Raspbian) configured – resuming normal operations
[Thu Jan 31 09:22:09.951287 2019] [core:notice] [pid 12610] AH00094: Command line: ‘/usr/sbin/apache2’
[Thu Jan 31 09:29:33.149010 2019] [mpm_prefork:notice] [pid 12610] AH00169: caught SIGTERM, shutting down

It seems to be an issue with certificate. Looks like Apache cannot be startet, because the config tries to read a certificate which does not exist in expected place ( /etc/apache/ssl/apache.key).

Check if key is present:

ls -alF /etc/apache/ssl/

i’ve managed to resolve. The problem was when i was trying to transfer the nextcloud data folder to an External HDD.

Can somebody please help me do it.

Data directory will be defined in config.php. But it is not that easy as the database is affected as well. This topic might be helpful…

i guess its best to do when configuring the nextcloud itself and the way i know is to reinstall the whole thing again.

I would re-install as well. And I did really often in the beginning. :wink:

ok so next cloud is up and running.
how do i add an external hdd.

Disk /dev/sda: 1.8 TiB, 2000365289472 bytes, 3906963456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xce89cfe4

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 3906963455 3906961408 1.8T 83 Linux

i can see the above when using the command " sudo fdisk -l"

and i can see the following files

pi@raspberrypi:/media $ ls
nextcloud pi

would the hdd be ready to transfer the data directory from var/www/html/data to media/nextcloud ?

i just learned it had to be unmounted first and formated to delete the contents. I did it and now how do i mount it ?

It depends on your system. I need to add the UUID of the disk to /etc/fstab and then I mount it.

This is the way like I do:

UUID=`blkid | grep -v "vfat" | cut -d '"' -f2`
mkdir /media/usbhdd-a
echo "UUID="$UUID" /media/usbhdd-a ext4 defaults 0 0" >> /etc/fstab
mount -a

# creation of Nextcloud data directory
mkdir /media/usbhdd-a/nextcloud
mkdir /media/usbhdd-a/nextcloud/data
chown -R www-data:www-data /media/usbhdd-a/nextcloud

Thanks. i’v got the HDD mounted. but after moving the data directory from the initially created folder

/var/www/html/nextcloud/data to 'media/pi/nc_dataStore/data

and the page does not load anymore. The webpage navigates to

http://192.168.100.188/nextcloud/index.php

and stops. what could be wrong ?

Do you remember last screen to finish the setup? There you need to define your data directory.

https://docs.nextcloud.com/server/15/admin_manual/installation/installation_wizard.html#data-directory-location-label

Use /media/pi/nc_dataStore/data instead of /opt/nextcloud as given in the example.