Server version: Apache/2.4.38 (Unix)
PHP Version: PHP 7.3.3 (cli) (built: Mar 6 2019 18:03:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.3, Copyright (c) 1999-2018, by Zend Technologies
OS: Linux archlinux 5.0.0-arch1-1-ARCH #1 S
Nextcloud: 15.0.5
Hello everyone. I am new to NextCloud and web in general. I am trying to set up a nextcloud web front with a domain over HTTPS. Simple… or so I thought
-
I got the web front to load. I was able to log in and everything. It worked over both the local IP and domain.
-
Next, I downloaded a certificate from LetsEncrypt. Everything appeared to go smoothly but my connection was still unsecured HTTP
-
I forwarded port 443 on my router already
-
I don’t know what I did after that. I messed around with a ton of config files by changing ServerNames, VirtualHosts and all sorts of stuff.
-
Now my webpage loads to HTTP ERROR 500
I have ABSOLUTELY NO CLUE what I misconfigured to get here. I don’t know enough to isolate the problem. I modified httpd.conf, config.php, and multiple .htaccess files. I may have messed with more stuff but I wouldn’t remember off the top of my head. My information is in the httpd.conf file. I will provide you with the error logs. What files should I start digging through?
/var/log/REDACTED.com.info-error_log
[Mon Mar 11 20:49:26.529013 2019] [php7:error] [pid 881] [client REDACTED:49053] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /usr/share/webapps/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /usr/share/webapps/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()\n#1 /usr/share/webapps/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()\n#2 /usr/share/webapps/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()\n#3 /usr/share/webapps/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()\n#4 /usr/share/webapps/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)\n#5 /usr/share/webapps/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection in /usr/share/webapps/nextcloud/lib/private/DB/Connection.php on line 64
/etc/webapps/nextcloud/config/config.php
<?php $CONFIG = array ( 'instanceid' => 'REDACTED', 'passwordsalt' => 'REDACTED', 'secret' => 'REDACTED', 'trusted_domains' => array ( 0 => '192.168.1.2', 1 => 'REDACTED', 2 => 'REDACTED', ), 'datadirectory' => '/usr/share/webapps/nextcloud/data', 'dbtype' => 'mysql', 'version' => '15.0.5.3', 'overwrite.cli.url' => 'http://192.168.1.2', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'mysql.utf8mb4' => true, 'dbuser' => 'daniel', 'dbpassword' => 'REDACTED', 'installed' => true, );
/var/log/httpd/error_log
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using REDACTEDIPv6. Set the ‘ServerName’ directive globally to suppress this message
[Mon Mar 11 21:18:28.080687 2019] [mpm_prefork:notice] [pid 1049] AH00163: Apache/2.4.38 (Unix) PHP/7.3.3 configured – resuming normal operations
[Mon Mar 11 21:18:28.080742 2019] [core:notice] [pid 1049] AH00094: Command line: ‘/usr/bin/httpd -D FOREGROUND’
[Mon Mar 11 21:21:35.279365 2019] [mpm_prefork:notice] [pid 1049] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Mar 11 21:21:35.407886 2019] [mpm_prefork:notice] [pid 1069] AH00163: Apache/2.4.38 (Unix) PHP/7.3.3 configured – resuming normal operations
[Mon Mar 11 21:21:35.407941 2019] [core:notice] [pid 1069] AH00094: Command line: ‘/usr/bin/httpd -D FOREGROUND’
[Mon Mar 11 21:23:37.312514 2019] [mpm_prefork:notice] [pid 1069] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Mar 11 21:23:37.429584 2019] [mpm_prefork:notice] [pid 1086] AH00163: Apache/2.4.38 (Unix) PHP/7.3.3 configured – resuming normal operations
[Mon Mar 11 21:23:37.429635 2019] [core:notice] [pid 1086] AH00094: Command line: ‘/usr/bin/httpd -D FOREGROUND’
Solution
Reinstall Nextcloud and it’s respective dependencies.
recertified with Certbot. Take note of the private key location in the output logs.
Now we are back to where we started.
Follow the TLS installation instructions in the AUR
Modify the ssl config
sudo nano /etc/httpd/conf/extra/httpd-ssl.conf
Change ServerName, Admin and Document Root
If you want to add strict non-redirectable HTTPS (and you should), Add a line under
Header always set Strict-Transport-Security “max-age=31536000; includeSubdomains; preload”
If you chose to add strict-transport security, edit the nextcloud file
sudo nano /etc/httpd/conf/extra/nextcloud.conf
If you want to add strict non-redirectable HTTPS (and you should), Add a line under <VirtualHost *:80>
Redirect permanent / https://example.com
save and close
Restart apache