Pg_admin nach upgrade auf Suse 15.2 funktioniert nicht mehr

Dann vermute ich nicht Berechtigungen als Problem-Ursache.

Was mich stutzig macht ist:

Aus meiner Erfahrung sollte man nichts manuell ins VEnv reinkopieren. Schon wenn man das komplette VEnv an eine andere Stelle im Dateisystem verschiebt, gab es bei mir immer Probleme und es lies sich nicht mehr verwenden.

Also wenn wirklich was manuell verschoben oder kopiert wurde, dann würde ich empfehlen das VEnv neu aufzubauen. So wie @Gisman es exemplarisch gezeigt hat.

Ich habe mich schon länger nicht mehr mit Apache beschäftigt. Früher war es doch so, daß bei der Eingabe von localhost:80 der Inhalt der Datei /srv/www/htdocs/index.html im Browser angezeigt wurde; jetzt bekomme die Fehlermeldung 403 Zugriff verweigert, die Datei ist vorhanden.

sudo -u wwwrun cat /srv/www/htdocs/index.html
[sudo] Passwort für wwwrun: 
<html>
<head>
<title> Test Apache </title>
</head>
<body>
<h1> Guten Tag </h1>
<p> Apache sollte funktionieren :-)</p>
</body>
</html>

systemctl status apache2
● apache2.service - The Apache Webserver
   Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-08-04 10:40:54 CEST; 35min ago
 Main PID: 1537 (httpd-prefork)
   Status: "Processing requests..."
    Tasks: 35
   CGroup: /system.slice/apache2.service
           ├─1537 /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//>
           ├─1763 /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//>
           ├─1764 /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//>
           ├─1765 /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//>
           ├─1766 /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//>
           ├─1767 /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//>
           ├─1769 /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//>
           └─3348 /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//>

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

Hat sich da etwas verändert oder stimmt an meiner Apache-Installation etwas nicht. Ich habe Apache über YAST installiert.

Rüdiger

Wo die Startpage gesucht wird, wird in der Apache Configuration über
DocumentRoot, DirectoryIndex festgelegt.

Nur um sicher zu gehen, das die Apache-Threads wirklich als wwwrun ausgeführt werden, bitte das mal prüfen:
ps -Ao pid,ppid,user,group,cmd | grep httpd | grep -v grep

 ps -Ao pid,ppid,user,group,cmd | grep httpd | grep -v grep
 1533     1 root     root     /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -DSYSTEMD -DFOREGROUND -k start
 1758  1533 wwwrun   www      /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -DSYSTEMD -DFOREGROUND -k start
 1759  1533 wwwrun   www      /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -DSYSTEMD -DFOREGROUND -k start
 1760  1533 wwwrun   www      /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -DSYSTEMD -DFOREGROUND -k start
 1761  1533 wwwrun   www      /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -DSYSTEMD -DFOREGROUND -k start
 1762  1533 wwwrun   www      /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -DSYSTEMD -DFOREGROUND -k start
 1764  1533 wwwrun   www      /usr/sbin/httpd-prefork -DSYSCONFIG -Dpgadmin4.conf -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -DSYSTEMD -DFOREGROUND -k start

in /etc/apache2/default-server.conf

DocumentRoot "/srv/www/htdocs"

#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">

ls -ltr *.conf
-rwxr-xr-x 1 wwwrun www   22 Jun 22 18:50 uid.conf
-rwxr-xr-x 1 wwwrun www 6565 Jun 22 18:50 ssl-global.conf
-rwxr-xr-x 1 wwwrun www 4961 Jun 22 18:50 server-tuning.conf
-rwxr-xr-x 1 wwwrun www  743 Jun 22 18:50 protocols.conf
-rwxr-xr-x 1 wwwrun www   85 Jun 22 18:50 mod_usertrack.conf
-rwxr-xr-x 1 wwwrun www 1504 Jun 22 18:50 mod_userdir.conf
-rwxr-xr-x 1 wwwrun www  448 Jun 22 18:50 mod_status.conf
-rwxr-xr-x 1 wwwrun www 1020 Jun 22 18:50 mod_reqtimeout.conf
-rwxr-xr-x 1 wwwrun www 5245 Jun 22 18:50 mod_mime-defaults.conf
-rwxr-xr-x 1 wwwrun www 1058 Jun 22 18:50 mod_log_config.conf
-rwxr-xr-x 1 wwwrun www  467 Jun 22 18:50 mod_info.conf
-rwxr-xr-x 1 wwwrun www  344 Jun 22 18:50 mod_cgid-timeout.conf
-rwxr-xr-x 1 wwwrun www 1504 Jun 22 18:50 mod_autoindex-defaults.conf
-rwxr-xr-x 1 wwwrun www 1957 Jun 22 18:50 loadmodule.conf
-rwxr-xr-x 1 wwwrun www  749 Jun 22 18:50 listen.conf
-rwxr-xr-x 1 wwwrun www  128 Jun 22 18:50 global.conf
-rwxr-xr-x 1 wwwrun www 2924 Jun 22 18:50 errors.conf
-rwxr-xr-x 1 wwwrun www 4257 Jun 22 18:50 default-server.conf
-rwxr-xr-x 1 wwwrun www 9325 Jul 29 15:11 httpd.conf

Mir gehen die Ideen aus. :frowning:
DirectoryIndex ist für das Verzeichnis <Directory "/srv/www/htdocs"> gesetzt?
Müsste ja in dem Fall index.html sein.

Auszug aus /etc/apache2/httpd.conf

DirectoryIndex phpPgAdmin/index.php /srv/www/htdocs/index.html index.html index.html.var

Ich weiß, daß ich Apache unter einer früheren SuSe-Version am Laufen hatte. Ich werde mich mal im SuSe-Forum umschauen, vielleicht werde ich da fündig.
Ich melde mich dann wieder.

Bis hier hin, Besten Dank an Euch beide.

Rüdiger

Hallo!
Zum Thema Apache:
Du kannst zwei Dinge tun:

  1. PGadmin läuft mit seinem eigenen Server auf Port 5050, dann könntest du das direkt üver den Port ansprechen (muß in der FW freigegeben sein!) oder per mod_rewrite/mod_proxy eine Umleitung im Apachen einbauen.
    Zur Portfreigabe: Wenn die FW nicht läuft habe ich den Eindruck, dass bei Suse per default alles gedroppt wird und nicht einfach weitergeleitet. Also mußt du die FW starten und in der Defaultzone die benötigten Dienste oder Ports freigeben.

  2. PGAdmin wird über mod_wsgi eingebunden. Das ist die empfohlene Lösung. Hier steht wie das geht. Du musst nur aufpassen, das du mod_wsgi für Python3 installierst. (Hier ist auch der Punkt an dem ich hänge. Alle Pfade und Berechtigungen stimmen, allerdings wird die venv vom Apachen nicht erkannt :frowning: )

So ist bei mir eine funktionierende Flask-App mittels Apache und WSGI konfiguriert.
Im letzten Abschnitt steht wie ich die VEnv in WSGI aktiviert habe.
Eventuell hilft das.

$ cat /etc/apache2/conf.d/zypper_upload_service.conf

WSGIDaemonProcess zypper_upload_service user=wwwrun group=www threads=2
WSGIScriptAlias /zypper_upload_service /srv/www/htdocs/zypper_upload_service/zypper_upload_service.wsgi

<Directory "/srv/www/htdocs/zypper_upload_service">
    WSGIProcessGroup zypper_upload_service
    WSGIApplicationGroup %{GLOBAL}
    Require all granted
</Directory>
$ namei -l /srv/www/htdocs/zypper_upload_service

f: /srv/www/htdocs/zypper_upload_service
drwxr-xr-x root   root /
drwxr-xr-x root   root srv
drwxr-xr-x root   root www
drwxr-xr-x root   root htdocs
drwxr-xr-x wwwrun www  zypper_upload_service
$ cat /etc/apache2/conf.d/zypper_upload_service.wsgi

import sys

# Set real path
sys.path.insert(0, '/srv/www/htdocs/zypper_upload_service')

# Activate Python VirtualEnv
activate_this = '/srv/www/htdocs/zypper_upload_service/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

# Load the application
from zypper_upload_service import app as application

Vielen Dank! Hier gibt es kein activate_this.py. Vermutlich ist das Shellskript activate zu verwenden.

Das Beispiel war unter einem älteren SLES.

Privat verwende ich Arch und da habe ich auch kein activate_this.py mehr im VEnv.

Da sieht meine wsgi so aus.

import sys
import os

# Set real path
app_root_dir = '/path/to/website/'
os.chdir(app_root_dir)
sys.path.insert(0, app_root_dir)

# Load the application
from website import app as application

Das entscheidene ist, sehe ich gerade, aber die Apache WSGI Konfiguration.
Der Parameter python-home

...
WSGIDaemonProcess website python-home=/path/to/venv threads=2
...

Ich denke ich habe ein Problem mit den Python Versionen

python -V
Python 3.6.12

Im WSGI-File

import os
import sys
print(sys.platform)
print(sys.version_info)

bekomme ich folgendes Ergebnis im Log-File

pgadmin_env36/lib/python3.6/site-packages/pgadmin4/abc.wsgi'.
[Mon Aug 16 21:04:21.134631 2021] [wsgi:error] [pid 6596] linux2
[Mon Aug 16 21:04:21.134698 2021] [wsgi:error] [pid 6596] sys.version_info(major=2, minor=7, micro=18, releaselevel='final', serial=0)

OS = linux2, welches ich als Pythonversion 2.* interpretiere
Version: Major: 2 Minor=7
Ich bräuchte aber wenigsten Version 3.4 von Python, welche ja installiert ist. Wo kann dem Environment beibringen, daß es bitte unter der Version 3.6.12 laufen soll ?

Rüdiger

Ist ein bisschen doof, das Suse immer noch unter ‘python’ Python2 versteht. Der folgende Befehl sollte eine Virtuelle Umgebung mit Python 3 erzeugen. Wenn du mit WSGI arbeitest mußt du noch das Apache-Modul mod_wsgi tauschen.

python3 -m venv <name_des_env>

Viele Grüße
Uwe

Uwe,
vielen Dank !
Ich habe mit dem Befehl

/python_env # python3 -m venv pgadmin_env 
kuchen:/python_env # ls 
pgadmin_env

ein neues Environment erzeugt.
Wenn ich aus dem aktivierten Environment diesen Befehl ausführe

python /python_env/pgadmin_env/lib/python3.6/site-packages/pgadmin4/pgAdmin4.py

wird pgadmin gestartet und ich kann über localhost:5050 mit pgadmin arbeiten.

Führe ich das wsgi-script pgAdmin4.wsgi über das config-file unter /etc/apache2/conf.d aus, dann befinde ich mich in der Version 2.7.

  WSGIDaemonProcess pgadmin4 python-home=/python_env/pgadmin_env/   processes=1 threads=25 display-name=%{GROUP} 
    WSGIProcessGroup pgadmin4
    WSGIScriptAlias /pgadmin4 /python_env/pgadmin_env/lib/python3.6/site-packages/pgadmin4/pgAdmin4.wsgi

    <Directory /python_env/pgadmin_env/lib/python3.6/site-packages/pgadmin4/>

Ich habe folgendes Apache_mod_wsgi installiert.

zypper info apache2-mod_wsgi
Loading repository data...
Reading installed packages...


Information for package apache2-mod_wsgi:
-----------------------------------------
Repository     : Main Repository
Name           : apache2-mod_wsgi
Version        : 4.5.18-lp152.4.7
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 461.4 KiB
Installed      : Yes
Status         : up-to-date
Source package : apache2-mod_wsgi-4.5.18-lp152.4.7.src
Summary        : A WSGI interface for Python web applications in Apache
Description    : 
    The mod_wsgi adapter is an Apacheache module that provides a WSGI compliant
    interface for hosting Python based web applications within Apache. The
    adapter is written completely in C code against the Apache C runtime and
    for hosting WSGI applications within Apache has a lower overhead than using
    existing WSGI adapters for mod_python or CGI.

Ist das das Richtige ?

Grüße,
Rüdiger

Bei mir heisst das Modul apache2-mod_wsgi-python3

Grüsse Uwe

Uwe,
vielen Dank !
Das war die Lösung.
Grüße,
Rüdiger

Dieses Thema wurde automatisch 60 Tage nach der letzten Antwort geschlossen. Es sind keine neuen Antworten mehr erlaubt.