Fresh installation - Ubuntu Server 18.04 LTS - This content failed to load

Hello !

After a “bad” experience (external storage not accessible) with the snap installation of Nextcloud, I decided to follow the guide to install it myself on my freshly installed Ubuntu Server 18.04 LTS.

So I followed the guide step by step and at first login I got this nice welcome page:

It’s installed in there:
/var/www/nextcloud
With the following permission on the folder:
drwxr-xr-x 15 www-data www-data 4096 janv. 21 16:05 nextcloud/

The nextcloud.log is empty unfortunately, the apache2 error.log is not really relevant from what I’ve seen.

In the overview I got:

  • An error occured during the server configuration verification.
  • You access this site in HTTP … bla bla bla, it’s better in HTTPS.
  • The web server configuration doesn’t allow to reach “/.well-known/caldav”. You’ll find more information in the documentation.
  • The web server configuration doesn’t allow to reach “/.well-known/carddav”. You’ll find more information in the documentation.

I can navigate in the options but not making any change, when password is asked and I type it I got an error. If I go to application tab I got this:
"An error occured during the request. Impossible to process the request."

I checked the troubleshooting section in the guide, didn’t find anything. Searched on Google, find that other people had this issue with other OS, other versions of Nextcloud and that no real solution was ever brought.

I’m at your disposal to give any information you may need in order to help me get Nextcloud up and running :slight_smile:

if you don’t mind to setup another fresh Ubuntu installation, run my playbook and you should be fine.

it’s more or less the scripted version of this howto.
https://www.c-rieger.de/nextcloud-installation-guide-ubuntu/

btw: this is normal and can be ignored. it’s not the cause of your problem.

1 Like

It’s a bare metal home serveur that already have a NAS and a standalone Kodi on it.
So if I can avoid to completely reinstall Ubuntu it would be great. :slight_smile:

For the moment I removed all that I had installed for Nextcloud (PHP, Apache, MariaDB and all).
And if I could understand why this isn’t working I’d rather prefer that over just reinstall everything.

But thanx for this interesting answer, I’ll keep that in case I don’t find any other solution.

Can you post your Apache configuration?

Are the permissions on the data directory correct? (In my case it’s 750 aka drwxr-x---, which works.)

Do you have an .htaccess file in /var/www/nextcloud or your data directory that might prevent access?

1 Like

Thank you for helping me.

I just finished a complete Apache, MariaDB, PHP and Nextcloud reinstall … now I have an internal server error right in the beginning.

I touched nothing more than what’s in the installation guide and yes the rights are set correctly.

root@raging-server:~# cd /var/www
root@raging-server:/var/www# ll
total 16
drwxr-xr-x 4 root root 4096 janv. 22 12:10 ./
drwxr-xr-x 14 root root 4096 janv. 22 12:02 …/
drwxr-xr-x 2 root root 4096 janv. 22 12:03 html/
drwxr-x— 14 www-data www-data 4096 janv. 22 12:28 nextcloud/

Here is the /var/www/nextcloud/.htaccess:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers
    Header set X-Content-Type-Options "nosniff"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Robots-Tag "none"
    Header set X-Download-Options "noopen"
    Header set X-Permitted-Cross-Domain-Policies "none"
    Header set Referrer-Policy "no-referrer"
    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for static resources
  <FilesMatch "\.(css|js|svg|gif)$">
    Header set Cache-Control "max-age=15778463"
  </FilesMatch>

  # Let browsers cache WOFF files for a week
  <FilesMatch "\.woff2?$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>
</IfModule>
<IfModule mod_php5.c>
  php_value upload_max_filesize 511M
  php_value post_max_size 511M
  php_value memory_limit 512M
  php_value mbstring.func_overload 0
  php_value always_populate_raw_post_data -1
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_php7.c>
  php_value upload_max_filesize 511M
  php_value post_max_size 511M
  php_value memory_limit 512M
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT}  DavClnt
  RewriteRule ^$         /remote.php/webdav/          [L,R=302]
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/webfinger /public.php?service=webfinger [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz
</IfModule>
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>

And here is the /etc/apache2/apache2.conf (I removed the comments in the file for this post):

DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf

The server was installed 2 days ago on Ubuntu Server 18.04 LTS (ISO grabbed on the Ubuntu official website) and all the latests updates made via apt update && apt upgrade.

The only things I have on this server is a samba share over my local network (because it’s also my NAS) and a Kodi installed in standalone.

Also installed but less relevant here: iptables, portsentry and fail2ban (yes my IP’s are in the jail.conf).
Here is the rules I have in my iptables in case you want to be sure it’s not the firewall:

root@raging-server:/var/www/nextcloud# cat /etc/iptables.rules
# Generated by iptables-save v1.6.1 on Mon Jan 21 07:18:54 2019
*filter
:INPUT DROP [158:38296]
:FORWARD DROP [0:0]
:OUTPUT DROP [22:6196]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -p tcp -m tcp -s 192.168.0.0/24 --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -p tcp -s 192.168.0.0/24 --dport 139 -j ACCEPT
-A INPUT -p tcp -s 192.168.0.0/24 --dport 445 -j ACCEPT
-A INPUT -p udp -s 192.168.0.0/24 --dport 137 -j ACCEPT
-A INPUT -p udp -s 192.168.0.0/24 --dport 138 -j ACCEPT
-A INPUT -p udp -s 192.168.0.0/24 --dport 445 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m limit --limit 1/sec -j ACCEPT
-A FORWARD -p udp -m limit --limit 1/sec -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 8 -m limit --limit 1/sec -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK RST -m limit --limit 1/sec -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -p icmp -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 53 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 123 -j ACCEPT
-A OUTPUT -p tcp --dport 139 -j ACCEPT
-A OUTPUT -p tcp --dport 445 -j ACCEPT
-A OUTPUT -p udp --dport 137 -j ACCEPT
-A OUTPUT -p udp --dport 138 -j ACCEPT
-A OUTPUT -p udp --dport 445 -j ACCEPT
COMMIT
# Completed on Mon Jan 21 07:18:54 2019

If you need anything else, just ask.

Sorry, I should’ve been more specific: the error is likely in the apache configuration file in which your Nextcloud virtualhost is configured. So most likely something in /etc/apache2/sites-available, do you have anything there?

Here is the content of the folder:

root@raging-server:/etc/apache2/sites-available# ll
total 24
drwxr-xr-x 2 root root 4096 janv. 22 14:24 ./
drwxr-xr-x 8 root root 4096 janv. 22 12:32 ../
-rw-r--r-- 1 root root 1332 oct.  10 18:59 000-default.conf
-rw-r--r-- 1 root root 6338 oct.  10 18:59 default-ssl.conf
-rw-r--r-- 1 root root  248 janv. 22 12:13 nextcloud.conf

The content of 000-default.conf file:

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

And the content of the nextcloud.conf file:

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

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

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

     SetEnv HOME /var/www/nextcloud
     SetEnv HTTP_HOME /var/www/nextcloud

    </Directory>

And here is the page I’ve got when I try to reach 192.168.0.19/nextcloud:

It’s in french and it says “Internal server error”.

Well, I installed in with Docker and it works perfectly.

Nevertheless I think your nextcloud.conf file was wrong. At the beginning of the file there should be something like:
<VirtualHost *:80>

	ServerName <yourservername>
	ServerAdmin yourserveradmin@xxxxxx

	DocumentRoot /var/www/nextcloud


    	# Deny access to root-directory
        # 
    	<Directory />
		Require all denied
        </Directory>

Well, maybe, we’ll never know.
It’s working now :slight_smile: