Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Du hast Probleme mit Deinem eMail-Programm, Webbrowser oder Textprogramm? Dein Lieblingsprogramm streikt?
Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 06.01.2023 11:12:02

Hallo @oln,
gestern habe ich noch einige Einstellungen in den php.ini vorgenommen, was dann dazu geführt hat, dass der "interne Server Error" verschwand und zu "access denied" geführt hat. Diese Modifikationen liefen allerdings unter dem Punkt "Optimierungen".

Hier die Ausgabe:

Code: Alles auswählen

root@nextcloudpi:/home/pi# apache2ctl -M
Loaded Modules:root@nextcloudpi:/home/pi# apache2ctl -M
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)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authnz_external_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)
 headers_module (shared)
 http2_module (shared)
 mime_module (shared)
 mpm_event_module (shared)
 negotiation_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 proxy_http_module (shared)
 proxy_wstunnel_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 unique_id_module (shared)
Und hier die zweite Ausgabe:

Code: Alles auswählen

root@nextcloudpi:/home/pi# cat /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
	Listen 443
</IfModule>

<IfModule mod_gnutls.c>
	Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Der Zugriff über den Domainnamen und via interner IP führt zum "access denied", wobei auch der http Aufruf zu https weitergeleitet wird. UFW habe ich deaktiviert, fail2ban läuft noch, was aber auch bei Deaktivierung keine Änderung bringt. Mit den Modifikationen von gestern laufen jetzt auch wieder die occ Scripte.

Wie kann ich die Zertifikate und Pfade prüfen?

Gestern wollte ich mein Let's Encrypt Zertifikat erneuern, was aber laut Ausgabe bis März23 nicht notwendig ist. Im Dashboard der NC ist soweit auch alles ok. Der Fehler "nextcloud check" ist jetzt weg und steht wieder auf "ok". "HPB Service" ist noch down, was aber mit dem aktuellen Problem wahrscheinlich nicht zusammen hängt.

Einen neuen Vhost kann ich mal aufsetzen, wird aber etwas Zeit benötigen. Wie würdest Du da vorgehen?

Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 06.01.2023 12:59:50

Die aktuelle nextcloud.conf:

/etc/apache2/sites-available/nextcloud.conf:

Code: Alles auswählen

### DO NOT EDIT! THIS FILE HAS BEEN AUTOMATICALLY GENERATED. CHANGES WILL BE OVERWRITTEN ###

<IfModule mod_ssl.c>
  <VirtualHost _default_:443>
    DocumentRoot /var/www/nextcloud
    ServerName xx.xx
    CustomLog /var/log/apache2/nc-access.log combined
    ErrorLog  /var/log/apache2/nc-error.log
    SSLEngine on
    SSLProxyEngine on
    SSLCertificateFile   /etc/letsencrypt/live/xx.xx/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/xx.xx/privkey.pem

    # For notify_push app in NC21
    ProxyPass /push/ws ws://127.0.0.1:7867/ws
    ProxyPass /push/ http://127.0.0.1:7867/
    ProxyPassReverse /push/ http://127.0.0.1:7867/
  </VirtualHost>

  <Directory /var/www/nextcloud/>
    Options +FollowSymlinks
    AllowOverride All
    <IfModule mod_dav.c>
      Dav off
    </IfModule>
    LimitRequestBody 0
    SSLRenegBufferSize 10486000
  </Directory>
  <IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains"
  </IfModule>
</IfModule>
Diese vhost befindet sich neben der ncp und @000-default.conf in sites-enabled. xx.xx.ist die Domain. Die Links zu "SSLCertificateFile /etc/letsencrypt/live/xx.xx/fullchain.pem" und "SSLCertificateKeyFile /etc/letsencrypt/live/xx.xx/privkey.pem" habe ich kontrolliert. Die Dateien liegen dort mit dem Datum 03. Jan. 2023.
Zuletzt geändert von Mesquita am 06.01.2023 13:15:36, insgesamt 1-mal geändert.

Benutzeravatar
oln
Beiträge: 487
Registriert: 05.01.2021 09:41:24

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von oln » 06.01.2023 13:12:39

Mesquita hat geschrieben: ↑ zum Beitrag ↑
06.01.2023 11:12:02
Einen neuen Vhost kann ich mal aufsetzen, wird aber etwas Zeit benötigen. Wie würdest Du da vorgehen?
Das ist kein Hexenwerk. Eigentlich sollten folgende Datei schon vorhanden sein: /etc/apache2/sites-available/default-ssl.conf
Dort änderst du die Zeilen mit den Zertifikaten auf deine.

Code: Alles auswählen

SSLCertificateFile   /etc/letsencrypt/live/xx.xx/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/xx.xx/privkey.pem
Nun noch den Handler in den Vhost:

Code: Alles auswählen

 		<FilesMatch \.php$>
                        SetHandler "proxy:unix:/var/run/php/php8.1-fpm.sock|fcgi://localhost/"
                </FilesMatch>
BTW: Das fehlt in deinem Nexcloud-Vhost.

Nun noch noch den Nexcloud-Vhost abschalten und den Default einschalten.

Code: Alles auswählen

a2dissite nextcloud
a2ensite default-ssl
So nun schast du mal im Broser auf deine URL womit du immer Nextcloud aufgerufen hast.
Da sollte jetzt die Debian-Apache-Defaultseite zu sehen sein.
Nun legst du unter /var/www/html/ eine index.php rein.
In die index.php schreibst du ein phpinfo rein:

Code: Alles auswählen

<?php
phpinfo();
Nun rufst du die Seite auf mit deineURl/index.php

Wenn das alles klappt, dann ist der Apache ok.
Gruß Ole
AbuseIPDB

Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 06.01.2023 15:13:34

Die vhost habe ich erstellt und getestet. Im Ergebnis erhalte ich die html Defaultseite. Beim Versuch auf die index.php zuzugreifen, kommt wieder "Access denied".

Was mich nur wundert, ich habe vorher unter dem nextcloud vhost auch eine info.php erstellt und diese erscheint. Diese habe ich nur kopiert in /var/www/html und umbenannt in index.php. Allerdings habe ich in meiner index.php noch "?>" ergänzt.

Das Handler:

Code: Alles auswählen

 		<FilesMatch \.php$>
                        SetHandler "proxy:unix:/var/run/php/php8.1-fpm.sock|fcgi://localhost/"
                </FilesMatch>
habe ich noch nicht in meinen nextcloud vhost übernommen.

Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 06.01.2023 15:30:00

Mittlerweile habe ich den Handler übernommen, es ändert sich aber nichts am Zustand. Mit ist aufgefallen, dass in sites-enabled auch die 000-default.conf enthalten ist. Macht das Sinn?

Benutzeravatar
oln
Beiträge: 487
Registriert: 05.01.2021 09:41:24

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von oln » 06.01.2023 18:22:36

Poste mal bitte deine apache.conf
Gruß Ole
AbuseIPDB

Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 06.01.2023 19:53:49

Hier die /etc/apach2/apache2.conf:

Code: Alles auswählen

# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#	/etc/apache2/
#	|-- apache2.conf
#	|	`--  ports.conf
#	|-- mods-enabled
#	|	|-- *.load
#	|	`-- *.conf
#	|-- conf-enabled
#	|	`-- *.conf
# 	`-- sites-enabled
#	 	`-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
#Mutex file:${APACHE_LOCK_DIR} default

#
# The directory where shm and other runtime files will be stored.
#

DefaultRuntimeDir ${APACHE_RUN_DIR}

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<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: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
	Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
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

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
ServerName localhost
<IfModule mod_security2.c>
  SecServerSignature " "
</IfModule>
Include /etc/adminer/adminer.conf
Die Datei hat den Zeitstempel vom Dez2020.

In der nc-error.log erscheint weiter der Fehler in Bezug auf "security.limit_extensions":

Code: Alles auswählen

[Sat Jan 07 08:55:22.163359 2023] [proxy_fcgi:error] [pid 12079:tid 547443573120] [client xxx.xxx.xxx.xxx:32976] AH01071: Got error 'Access to the script '/var/www/nextcloud/login' has been denied (see security.limit_extensions

Benutzeravatar
oln
Beiträge: 487
Registriert: 05.01.2021 09:41:24

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von oln » 07.01.2023 09:43:29

Ändere mal diesen Abschnitt:

Code: Alles auswählen

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

Code: Alles auswählen

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>
Danach den Apachen neu startern und nocheinmal probieren.
Gruß Ole
AbuseIPDB

Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 07.01.2023 11:46:26

Hallo Ole,
die Änderung hat im Ergebnis keine Veränderung gebracht, ich habe diese auch wieder zurückgesetzt. Was mir noch aufgefallen ist, dass laut nc-error.log immer noch der gleiche Fehler erscheint, jedoch die IP-Adresse nicht jene vom aktuellen Notebook, sondern meine externe feste IP vom Provider erscheint. Sollte aber normal sein, da der Domainname aufgelöst wird. Greife ich mittels interner IP-Adresse zu, erscheint auch meine aktuelle vom Notebook, logisch.

Ich habe aktuell keinen weiteren Ansatz und habe viel nach "security.limit_extensions" recherchiert. Es gab für mich kaum logische Ansatzpunkte.

Thomas

Benutzeravatar
oln
Beiträge: 487
Registriert: 05.01.2021 09:41:24

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von oln » 07.01.2023 12:18:20

Hast du irgendwas mit den Rechten an den Verzeichnissen gemacht? Darf der www-data da überhaupt rein?
Gruß Ole
AbuseIPDB

Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 07.01.2023 15:43:02

Änderungen habe ich nicht bewusst vorgenommen. Hier mal ls -l:

Code: Alles auswählen

drwxr-xr-x 47 www-data www-data  4096  9. Dez 08:14 3rdparty
drwxr-x--- 63 www-data www-data  4096  3. Jan 09:34 apps
-rw-r--r--  1 www-data www-data 19327  9. Dez 08:14 AUTHORS
drwxr-x---  2 www-data www-data  4096  7. Jan 11:22 config
-rw-r--r--  1 www-data www-data  4095  9. Dez 08:14 console.php
-rw-r--r--  1 www-data www-data 34520  9. Dez 08:14 COPYING
drwxr-xr-x 23 www-data www-data  4096  9. Dez 08:14 core
-rw-r--r--  1 www-data www-data  6317  9. Dez 08:14 cron.php
drwxr-xr-x  2 www-data www-data 12288  9. Dez 08:14 dist
-rw-r--r--  1 www-data www-data   156  9. Dez 08:14 index.html
-rw-r--r--  1 www-data www-data  3456  9. Dez 08:14 index.php
-rw-r--r--  1 www-data www-data    21  4. Jan 16:53 info.php
drwxr-xr-x  6 www-data www-data  4096  9. Dez 08:14 lib
-rw-r--r--  1 www-data www-data   283  9. Dez 08:14 occ
drwxr-xr-x  2 www-data www-data  4096  9. Dez 08:14 ocm-provider
drwxr-xr-x  2 www-data www-data  4096  9. Dez 08:14 ocs
drwxr-xr-x  2 www-data www-data  4096  9. Dez 08:14 ocs-provider
-rw-r--r--  1 www-data www-data  3139  9. Dez 08:14 public.php
-rw-r--r--  1 www-data www-data  5549  9. Dez 08:14 remote.php
drwxr-xr-x  4 www-data www-data  4096  9. Dez 08:14 resources
-rw-r--r--  1 www-data www-data    26  9. Dez 08:14 robots.txt
-rw-r--r--  1 www-data www-data  2452  9. Dez 08:14 status.php
drwxr-x---  3 www-data www-data  4096  9. Dez 08:14 themes
drwxr-x---  2 www-data www-data  4096  4. Jun 2022  updater
-rw-r--r--  1 www-data www-data   383  9. Dez 08:14 version.php
Die NC war plötzlich nach einem upgrade mit den neuen Repositorys nicht mehr erreichbar, was dazugeführt hat, dass ich neben php7.4 dann php8.2 hatte. Manuell installierte ich php8.1 nach und entfernte 8.2. An der Nextcloud habe ich keine Veränderungen vorgenommen. Uber das Dashboard, was problemlos läuft, wurde UFW und fail2ban deaktiviert. Nachrichten zu neuen Versionen bei Apps erhalte ich auch noch via Mail.

Im Moment bin ich fixiert auf "security.limit_extensions" als einzigen Fehler aus den Logs. Komme da aber nicht weiter.

Da mir aber die info.php hier angezeigt wird, "könnte" man vermuten, das Problem liegt intern in der Nextcloud. Die System-Infos im Dashboard zeigen aber keinen Fehler.

Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 08.01.2023 09:20:48

Hallo @oln, hallo @heisenberg

Ich habe noch einen Tipp bekommen. Mit dem geschilderten Problem schlagen sich einige herum. Die Lösung wäre wohl nicht auf php8.1 sondern "nur" auf php8.0 zu gehen. Da würde genau dieses Problem nicht auftreten!

Damit ich nicht weitere Fehler einbaue, möchte ich Euch fragen, wie ich "sicher" auf php8.0-fpm komme. Diesen Versuch würde ich noch machen wollen.

VG Thomas

Benutzeravatar
Mesquita
Beiträge: 127
Registriert: 18.10.2018 18:08:10

Re: Apache2 (netxtcloud) läuft nach Umstallung von php7.4 auf 8.1 nicht

Beitrag von Mesquita » 08.01.2023 15:16:09

Ich habe eine Lösung meines Problems gefunden, die NC läuft wieder, allerdings unter php8.0-fpm. :mrgreen: Nach der Entfernung aller php Pakete wurde php8.0 neu installiert und die ini Dateien angepasst. Nach 2 Verzeichniskorrekturen im Apache2 lief die NC.

Das Protokoll der NC gibt noch folgende Warnung aus:

Code: Alles auswählen

Could not predict suspiciousness: No models found
Es liefen sofort alle Geräte Win / Linux / Android.

Während der Fehlersuche habe ich fachlich viel gelernt. Danke an Euch :hail:

Der nächste Meilenstein wird Debian Bookworm sein. Ein Upgrade werde ich da nicht machen. Mein "alter" PI wird komplett ersetzt. So plane ich dies mal ein.

Nochmals vielen Dank für die Unterstützung! :THX:

Antworten