blairchristopher
Goto Top

Nginx hinter Pfsense(HAProxy) liefert nur Fehler 503

Hallo Profis,

an meiner Schule experimentiere ich gerade mit Nginx für BigBlueButton. Dabei habe ich das Problem, dass selbst eine Standardinstallation von Nginx vom Internet aus nicht erreichbar ist. Da kommt als Meldung nur 503 und mehr nicht. Ein Rechner im gleichen Netz wie der Nginx bekommt die „Welcome to nginx!“ Seite angezeigt. Der Server selbst läuft also. Ein Apache2 (Nextcloud) im gleichen Netz ist extern und intern erreichbar.

Netzaufbau:
Der Aufbau des Netzes ist definitiv nicht optimal, aber einfach im Moment nicht zu ändern:
Lancom Router mit öffentlicher IP und Portweiterleitung
Pfsense mit HAProxy als DMZ (10.0.0.2)
Server 1 (10.0.0.3) mit Nextcloud (Apache2) unter cloud.xyz.de
Server 2 (10.0.0.4) mit BigBlueButton (Nginx) unter bbb.xyz.de
(Sorry, besser bekomme ich das nicht hin.)

Folgende Dinge habe ich ausprobiert:
Die Nextcloud (Apache2) auf Server 1 (10.0.0.3) ist aus dem Internet und dem 10.0.0.0/24 Netz erreichbar und funktioniert wunderbar.
Der Nginx auf Server 2 (10.0.0.4) liefert aus dem Internet nur den Fehler 503, aber ist aus dem 10.0.0.0/24 Netz mit der IP und dem Subdomain-Namen (bbb.xyz.de) erreichbar. Da liefert er die „Welcome to nginx!“ Seite.
Installiere ich auf dem Server 2 (10.0.0.4) einen Apache2, dann ist der unter dem Subdomain-Namen (bbb.xyz.de) aus dem Internet und dem 10.0.0.0/24 Netz erreichbar.
Daher schließe ich, dass die DNS- Einträge beim Provider, die Portweiterleitung und der HAProxy auf der Pfsense funktionieren müssten.
Apache2 klappt, Nginx nicht.
Mir sind die Ideen ausgegangen, wo der Unterschied bei Nginx liegt und warum ich den Fehler 503 aus dem Internet bekomme.

Vielleich hat jemand einen Vorschlag, was ich ausprobieren könnte.

Vielen Dank,
Chris

Content-Key: 3401675001

Url: https://administrator.de/contentid/3401675001

Printed on: April 26, 2024 at 04:04 o'clock

Member: Dani
Dani Jul 21, 2022 at 19:22:42 (UTC)
Goto Top
Moin,
wie sieht die Konfiguration des Nginx aus?
was steht in den Logs vom Nginx zum Zeitpunk des Zugriffs drin?
welches Betriebssystem und Nginx Version nutzt du?
welche Version von pfSense wird genutzt?


Gruß,
Dani
Member: BlairChristopher
BlairChristopher Jul 21, 2022 at 21:00:27 (UTC)
Goto Top
Hallo Dani,
sorry für die fehlenden Infos.

welches Betriebssystem und Nginx Version nutzt du?
Ubuntu 20.04.4 LTS
nginx/1.18.0 (Ubuntu)

welche Version von pfSense wird genutzt?
Pfsense 2.6.0-Release Community Edition

wie sieht die Konfiguration des Nginx aus?
Die nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/x>
        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


#mail {
#       # See sample authentication script at:
#       # http:{{comment_single_line_double_slash:0}}
#
#       # auth_http localhost/auth.php;
#       # pop3_capabilities "TOP" "USER";  
#       # imap_capabilities "IMAP4rev1" "UIDPLUS";#  
#       server {
#               listen     localhost:110;
#               protocol   pop3;
#               proxy      on;
#       }
#
#       server {
#               listen     localhost:143;
#               protocol   imap;
#               proxy      on;
#       }
#}

Die default-Page:
##
# You should look at the following URL's in order to grasp a solid understanding 
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https:{{comment_single_line_double_slash:0}}
# https:{{comment_single_line_double_slash:0}}topics/tutorials/config_pitfalls/
# https:{{comment_single_line_double_slash:2}}
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #       # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!  
        #
        # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root  
        # concurs with nginx's one  
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}


# Virtual Host configuration for example.com# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#       listen 80;
#       listen [::]:80;
#
#       server_name example.com;
#
#       root /var/www/example.com;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}

was steht in den Logs vom Nginx zum Zeitpunk des Zugriffs drin?
Das error.log ist leer.
Das access.log hat jede Sekunde einen neuen Eintrag mit:
10.0.0.2 - - [21/Jul/2022:05:31:25 +0000] "OPTIONS / HTTP/1.0" 405 166 "-" "-"  
Die 10.0.0.2 ist die Pfsense mit dem HAProxy.
Wenn ich vom Internet zugreife und den Fehler 503 erhalte, dann wird kein anderer Eintrag erstellt.
Bei einem Zugriff mit dem Internet Explorer aus dem 10.0.0.0/24 Netz kommt folgendes:
10.0.0.2 - - [21/Jul/2022:20:58:54 +0000] "OPTIONS / HTTP/1.0" 405 166 "-" "-"  
10.0.0.2 - - [21/Jul/2022:20:58:55 +0000] "GET / HTTP/1.1" 200 396 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"  
10.0.0.2 - - [21/Jul/2022:20:58:55 +0000] "GET /favicon.ico HTTP/1.1" 404 134 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; Trident/7.0; rv:11.0) like Gecko"  
10.0.0.2 - - [21/Jul/2022:20:58:55 +0000] "OPTIONS / HTTP/1.0" 405 166 "-" "-"  

Ich hoffe, dass du damit was anfangen kannst.

Viele Grüße
Chris
Member: Dani
Dani Jul 22, 2022 at 08:54:32 (UTC)
Goto Top
Moin,
bist du dir sicher, dass der Fehler von Nginx und nicht HAProxy erzeugt wird? Ansonsten müsste im error.log und access.log ein Eintrag mit 503 sein. Seh ich haber nicht.


Gruß,
Dani
Member: BlairChristopher
BlairChristopher Jul 22, 2022 updated at 15:25:33 (UTC)
Goto Top
Hallo,
genau das kann ich ja nicht nachvollziehen oder prüfen.
Alles was ich weiß ist, dass die Einstellungen des HAProxy funktionieren, wenn Apache verwendet wird. Wenn ich auf dem gleichen Server stattdessen Nginx installiere und alles andere identisch bleibt (Netz, Server, Einstellungen, HAproxy, ...) funktioniert es nicht.

Folgender Eintrag ist mir unter Stats bei HAProxy auf der Pfsense aufgefallen:
bild2

Bei Nextloud/Apache2 steht Layer7 check passed: Moved permanently
Bei BBB/Nginx steht Layer7 wrong status: Not Allowed

Viele Grüße
Chris

Das Bild war vorher eigentlich scharf. Sorry. Wie bekomme ich es hier scharf?
Mitglied: 148523
Solution 148523 Jul 22, 2022 at 15:34:30 (UTC)
Goto Top
https://serverfault.com/questions/1066387/haproxy-health-check-fails-wit ...
https://forum.netgate.com/topic/94060/solved-basic-usage-of-haproxy
https://stackoverflow.com/questions/45798883/server-web1-is-down-reason- ...
usw.
Suche nach "haproxy nginx Layer 7 wrong status: Not Allowed" bringt fast immer die gleiche Problematik. Und
tcpdump auf dem Nginx ist wirklich dein bester Freund!! face-wink
Member: BlairChristopher
BlairChristopher Jul 23, 2022 at 09:34:59 (UTC)
Goto Top
Hallo,

auf der Pfsense habe ich im HAProxy unter dem entsprechenden Backend BBB die HTTP Check Method auf HEAD gestellt. Nun funktioniert es.

Vielen Dank
Chris