i am new to nextcloud ( and linux in general ) i have installed nextcloud via a installation guide How to Install NextCloud on Ubuntu 22.04 - RoseHosting .
i have 2 errors that i cant seem to fix
nextcloud version: 27.1.4
OS: Ubuntu 20.04
Apache version: apache2 2.4.41
PHP version: 8.3
Database: mariaDB
snap: yes NO (***edited***)
first time i’ve seen this error: yes
i have a HTTPS certificate from certbot
for the PHP isue: i have lookes throug the php.ini files and every time i see the output_buffering it is turned off or the value is set to 0
the .htaccess isue: i don’t know that the file needs to contain.
if you need more information please ask me.
if you have a fix please let me know
ernolf
January 10, 2024, 10:50am
2
Unfortunately, the information about your setup is not sufficient. There are literally thousands of instructions for setting up a nextcloud server.
Please edit your post using → this support template ← and fill out as much as possible.
Help can only be provided with information such as the web server used.
ernolf
ernolf
January 10, 2024, 10:17pm
4
Jamie_van_Kollenburg:
snap: yes
I’m not very familiar with the Snap package, so maybe someone with more Snap experience can give you more specific help.
What I can say is this:
Nextcloud ships with .htaccess
and .user.ini
files. These are usually read by your web server (.htaccess
) and your php (.user.ini
) unless you prevent it in the apache2 config.
The following lines must be present in your apache2.conf:
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
<FilesMatch "^\.ini">
Require all denied
</FilesMatch>
and in directory context of your nextcloud.conf
AllowOverride All
AllowOverride All
ensures, that the server reads the .htaccess
and .user.ini
files.
AllowOverride None
on the other hand ensures that the server does not read the .htaccess
and .user.ini
files. This can make the server faster, but then the entries from the .htaccess
file must be integrated in the apache2 config of the relevant directory and the entries from the .user.ini
should be integrated in the php.ini
of the php-SAPI which speaks with your apache2 (either libapache2-mod-php
or php-fpm
).
ernolf
jtr
January 11, 2024, 10:06pm
5
Based on the random guide you linked to, you did a manual installation. You’re not using Snap.
The main part that would cause both your issues is if the .htaccess that comes with the installation isn’t being used for some reason.
In the doc you linked to, the biggest area where that could get messed up is if you overlooked something in the Apache configuration (step 7).
Is there a .htaccess
file at /var/www/html/nextcloud
?
Does your VirtualHost
’s Directory
section have an AllowOverride All
in it as show in that guide?
Both of the errors you’re getting are related; .htaccess
handles both matters.
1 Like
there is a .htaccess file at /var/www/html/nextcloud
this is whats in it
<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 mod_lsapi.c>
SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
</IfModule>
</IfModule>
<IfModule mod_env.c>
# Add security and privacy related headers
# Avoid doubled headers by unsetting headers in "onsuccess" table,
# then add headers to "always" table: https://github.com/nextcloud/server/pull/19002
Header onsuccess unset Referrer-Policy
Header always set Referrer-Policy "no-referrer"
Header onsuccess unset X-Content-Type-Options
Header always set X-Content-Type-Options "nosniff"
Header onsuccess unset X-Frame-Options
Header always set X-Frame-Options "SAMEORIGIN"
Header onsuccess unset X-Permitted-Cross-Domain-Policies
Header always set X-Permitted-Cross-Domain-Policies "none"
Header onsuccess unset X-Robots-Tag
Header always set X-Robots-Tag "noindex, nofollow"
Header onsuccess unset X-XSS-Protection
Header always set X-XSS-Protection "1; mode=block"
SetEnv modHeadersAvailable true
</IfModule>
# Add cache control for static resources
<FilesMatch "\.(css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite)$">
<If "%{QUERY_STRING} =~ /(^|&)v=/">
Header set Cache-Control "max-age=15778463, immutable"
</If>
<Else>
Header set Cache-Control "max-age=15778463"
</Else>
</FilesMatch>
# Let browsers cache WOFF files for a week
<FilesMatch "\.woff2?$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
</IfModule>
<IfModule mod_php.c>
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_mime.c>
AddType image/svg+xml svg svgz
AddType application/wasm wasm
AddEncoding gzip svgz
# Serve ESM javascript files (.mjs) with correct mime type
AddType text/javascript js mjs
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>
<IfModule pagespeed_module>
ModPagespeed Off
</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/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]
RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
RewriteRule ^ocm-provider/?$ index.php [QSA,L]
RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####
ErrorDocument 403 /index.php/error/403
ErrorDocument 404 /index.php/error/404
i have not done annything to it myself. don’t know if the content of the file is correct
yes there is a .htaccess file at /var/www/html/nextcloud
and yes i have a virtualhost file with a AllowOverride All
ernolf
January 12, 2024, 10:40am
8
I suspect that mod_rewrite is not activated.
Run:
sudo a2enmod rewrite
sudo apachectl restart
If that does not fix your problem, could you please post the echo of
sudo apachectl -SM
That will give more insights.
Much and good luck,
ernolf
1 Like
it did not fix the issue, when i run sudo apachectl -SM this is the response
Data-Defend@Nextcloud:~$ sudo apachectl -SM
VirtualHost configuration:
*:443 Nextcloud."***REMOVED SENSITIVE VALUE***" (/etc/apache2/sites-enabled/default-ssl.conf:2)
*:80 is a NameVirtualHost
default server Nextcloud."***REMOVED SENSITIVE VALUE***" (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost Nextcloud."***REMOVED SENSITIVE VALUE***" (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost "***REMOVED SENSITIVE VALUE***" (/etc/apache2/sites-enabled/nextcloud.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: DUMP_MODULES
User: name="www-data" id=33
Group: name="www-data" id=33
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
ernolf
January 12, 2024, 11:24am
10
Jamie_van_Kollenburg:
apachectl -SM
mod_headers
is not loaded
Run
sudo a2enmod headers
sudo apachectl restart
Try if that solves your issue.
ernolf
1 Like
jtr
January 12, 2024, 4:59pm
11
In the future, check/cross reference any third-party documentation with the official docs (e.g.[1]) to make sure to catch any required modules/etc.
[1] Installation on Linux — Nextcloud latest Administration Manual latest documentation