[SOLVED]Seafile 6.3.2 Neuinstallation nginx start nicht mit HTTPS failed!

Hallo zusammen,

nach langem Testen und der zweiten Neuinstallation weiß ich grad leider nicht weiter. Version 6.3.2 läuft nach der Installation. Nun will ich aber auf HTTPS umstellen OHNE FastCGI (wird ja nicht mehr unterstützt)

Habe mich nun schon durch verschiede Anleitungen gehangelt aber immer wenn ich nginx neu starte bekomme ich ein FAILED!

Hier meine Systemkonfigurationen:

ccnet.conf

[General]
USER_NAME = Name vom Server
ID = 16b275d91aa03872a5d0f5105f7a60c8ca51f79f
NAME = Name vom Server
SERVICE_URL = https://192.168.178.88:8001

[Network]
PORT = 10001

[Client]
PORT = 13418

seahub_settings.py

HTTP_SERVER_ROOT = 'https://192.168.178.88:8001/seafhttp'

seafile.conf

[network]
port=12001
[fileserver]
host=0.0.0
port=8082
max_upload_size=4000
max_download_dir_size=4000

nginx config

server {
    listen 8001;
    ssl on;
    ssl_certificate /etc/ssl/seahub.crt;        # path to your cacert.pem
    ssl_certificate_key /etc/ssl/seahub.key;    # path to your privkey.pem
    server_name 192.168.178.88;
    error_page 497 https://$host:$server_port$request_uri;
    server_tokens off;
 
    proxy_pass         http://127.0.0.1:8000;
    proxy_set_header   Host $host:$server_port;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;
    proxy_set_header   X-Forwarded-Proto https;

    access_log /var/log/nginx/seahub.access.log; 
    error_log /var/log/nginx/seahub.error.log;
    proxy_read_timeout 1200s; 
    client_max_body_size 0;
}

location /seafhttp {
            rewrite ^/seafhttp(.*)$ $1 break;
            proxy_pass http://127.0.0.1:8082;
            client_max_body_size 0;
            proxy_request_buffering off;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_connect_timeout  36000s;
            proxy_read_timeout  36000s;
            proxy_send_timeout  36000s;
            send_timeout  36000s;
        }

        location /media {
            root /home/seafile/seafile/seafile-server-latest/seahub;
        }
 }

Vielleicht hat jemand schon ne laufenden Systemkonfiguration mit der Seafile Version 6.3.2? Für Hilfe wäre ich sehr dankbar.

Was genau meldet nginx denn als Fehler?
Meine Konfiguration sieht ähnlich aus. Ich hatte unter 6.3.2 Probleme mit der Zeile:
proxy_set_header Host $host:$server_port;
Nachdem ich sie auf
proxy_set_header Host $host;
geändert habe, läuft alles.

Leider keinen Erfolg mit der Zeile.

Hier die Fehlermeldung von nginx.

pi@raspberrypi:~ $ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-07-25 08:35:29 UTC; 1min 36s ago
     Docs: man:nginx(8)
  Process: 2052 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 1919 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 2471 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
 Main PID: 1920 (code=exited, status=0/SUCCESS)

Jul 25 08:35:29 raspberrypi systemd[1]: Starting A high performance web server and a reverse proxy server...
Jul 25 08:35:29 raspberrypi nginx[2471]: nginx: [emerg] "proxy_pass" directive is not allowed here in /etc/nginx/sites-enabled/seahub:10
Jul 25 08:35:29 raspberrypi nginx[2471]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jul 25 08:35:29 raspberrypi systemd[1]: nginx.service: Control process exited, code=exited status=1
Jul 25 08:35:29 raspberrypi systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 25 08:35:29 raspberrypi systemd[1]: nginx.service: Unit entered failed state.
Jul 25 08:35:29 raspberrypi systemd[1]: nginx.service: Failed with result 'exit-code'.

Hallo in deiner ccnet.conf steht ERVICE_URL nicht SERVICE_URL

Hier mein nginx Konfig für nginx 1.15.x

server {

	listen 1.2.3.4:80;
	listen 1.2.3.4:443 ssl http2;
	if ($scheme = http) { return 301 https://$server_name$request_uri;}
	server_name myserver;
	root /myserver;
	index index.html index.htm index.php;
	access_log /var/log/myserver_access.log;
	error_log /var/log/myserver_error.log;
	client_max_body_size 20m;
	ssl_trusted_certificate /etc/letsencrypt/le_x3_chain.pem;
	ssl_stapling on;
	ssl_stapling_verify on;
	resolver 2.3.4.5 2.3.4.5;
	resolver_timeout 10s;
	ssl_protocols TLSv1.2;
	ssl_session_tickets on;
	ssl_session_ticket_key /etc/letsencrypt/ngx_ticketkey;
	ssl_ecdh_curve secp384r1;
	ssl_dhparam /etc/letsencrypt/dhparam_4096.pem;
	ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305 ECDHE-RSA-CHACHA20-POLY1305 EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH DHE-RSA-CHACHA20-POLY1305 EDH+aRSA !AES128 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4 !SEED !CAMELLIA';
	ssl_prefer_server_ciphers on;
	ssl_certificate /etc/letsencrypt/live/myserver/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/myserver/privkey.pem;
	ssl_stapling_file /etc/letsencrypt/live/myserver/ocsp.resp;
	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
	add_header Referrer-Policy "no-referrer";
	add_header X-Frame-Options "ALLOW-FROM https://myserver/" always ;
	add_header X-Content-Type-Options nosniff;
	add_header X-XSS-Protection "1; mode=block";
	add_header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'" always;
	charset utf-8;
	location / {

		proxy_pass http://127.0.0.1:8000;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Host $server_name;
		proxy_read_timeout 1200s;
	}
	location /seafhttp {

		rewrite ^/seafhttp(.*)$ $1 break;
		proxy_pass http://127.0.0.1:8082;
		client_max_body_size 0m;
		proxy_connect_timeout 36000s;
		proxy_read_timeout 36000s;
		proxy_send_timeout 36000s;
		proxy_request_buffering off;
	}
	location /seafdav {

		fastcgi_pass 127.0.0.1:8080;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param PATH_INFO $fastcgi_script_name;
		fastcgi_param server_PROTOCOL $server_protocol;
		fastcgi_param QUERY_STRING $query_string;
		fastcgi_param REQUEST_METHOD $request_method;
		fastcgi_param CONTENT_TYPE $content_type;
		fastcgi_param CONTENT_LENGTH $content_length;
		fastcgi_param server_ADDR $server_addr;
		fastcgi_param server_PORT $server_port;
		fastcgi_param server_NAME $server_name;

		client_max_body_size 0;
		proxy_connect_timeout 36000s;
		proxy_read_timeout 36000s;
		proxy_send_timeout 36000s;
		send_timeout 36000s;

		# This option is only available for Nginx >= 1.8.0. See more details below.
		proxy_request_buffering off;

	}
	location /media {

		root /myserver/seafile-server-latest/seahub;
	}
}

Hallo Service_URL war nur ein Schreibfehler.

Hab deine Konfig mal etwas angepasst und getestet aber leider kein Start möglich. Deine Konfig nutzt ja z.B. auch “letsencrypt” was mein System nicht hat.

Vielleicht hat jemand noch eine andere Konfig?

Vielleicht hab ich bei der Installation von NGINX was falsch gemacht? Hatte bisher immer ne ganz gut und funktionierende Anleitung.

+++++ nginx installieren +++++

su pi

sudo apt-get install nginx

sudo sed -i "s/worker_processes 4;/worker_processes 1;/g" /etc/nginx/nginx.conf
sudo sed -i "s/worker_connections 768;/worker_connections 128;/g" /etc/nginx/nginx.conf

sudo /etc/init.d/nginx start

+++++ nginx einrichten +++++

sudo mkdir /etc/nginx/ssl
cd /etc/nginx/ssl
sudo openssl genrsa -out seahub.key 4096
sudo openssl req -new -sha256 -key seahub.key -out seahub.csr

Nun müssen wir ein selbst signiertes SSL Zertifikat erstellen. 
Dies können wir mittels folgenden Befehlen bewerkstelligen. 
Dabei werden beim vorletzten Befehl mehrere Fragen gestellt. 
Bei Country Name geben wir DE (ggf. abweichend) an und bei Common Name die verwendete IP-Adresse oder DynDNS Domain. 
Alle anderen Felder können wir mittels Enter überspringen.

sudo openssl x509 -req -sha256 -days 3650 -in seahub.csr -signkey seahub.key -out seahub.crt

nginx config datei

sudo nano /etc/nginx/sites-available/seahub

Vielleicht hat auch jemand eine funktionierende anleitung für die aktuelle Seafile Version und die HTTPS Einrichtung. Bin für jede Hilfe dankbar.

Hast du dir das schon mal angeschaut?

https://manual.seafile.com/deploy/https_with_nginx.html

Ja klar. Aber da muss ich ja noch viel mehr an der Konfig umbauen. Dann einen fehler zu finden wird ja noch schwerer.
Ich habe ja eine Installationsanleitung die bisher fuktioniert hat. Dementsprechend ist ja auch die Konfiguration. Nur OHNE FastCGI hab ich es noch nicht hinbekommen. Sollte doch egal sein ob “openssl genrsa” oder “openssl dhparam” oder?

@Tjelfe wie hast du so installiert? Also Seafile und NGINX? Du sagtest bei dir sieht es ähnlich aus? Hast du irgendwo eine Anleitung?

Ne, ist nicht egal. Das sind zwei verschiedene Stiefel.

Ich würde von dem „Sample Configuration File“ für nginx auf der von mir verlinkten Seite ausgehen und dann schrittweise anpassen. Im Manual sind auch die Einstellungen der ganzen config-Dateien von Seafile zu finden.

Beim Überfliegen von deiner nginx-config ist mir aufgefallen, dass die geschweifte Klammer nach client_max_body_size 0 falsch ist. Wenn du die löschst, stimmt zumindest schon mal die Grammatik.

An welcher Stelle der nginx-Konfiguration wird die von dir oben eingefügte nginx-config eingebunden? Das müsste in /etc/nginx/nginx.conf stehen.

Unter welcher URL hast du bisher deinen Seafile-Server angesprochen?

EDIT: die ganzen Proxy-direktiven müssten eigentlich in einen Location-Block. Im Server-Block haben die nichts zu suchen. Ich kann mich nur wiederholen: schau dir die Beispielkonfiguration im Manual an.

Also die Klammer ist raus :wink:

hier die /etc/nginx/nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 128;
        # 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; # 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_disable "msie6";

        # 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/javascrip$

        ##
        # Virtual Host Configs
        ##

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


#mail {
#       # See sample authentication script at:
#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#       # 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;
}


#mail {
#       # See sample authentication script at:
#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#       # 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;
#       }
#}

Ich werde deinen Ratschlag beherzigen und mir noch mal die andere Konfiguration anschauen.
Ich würde dann “openssl dhparam 2048 > /etc/nginx/dhparam.pem” nutzen aber schon dies wird so nicht zugelassen. “Permission denied”
Hatte es dann so gelöst “sudo openssl dhparam -out /etc/nginx/dhparam.pem 2048”
Ich kann doch einfach mit der laufenden Installation weiter testen auch wenn ich schon “openssl genrsa” ausgeführt habe oder?

Ich habe es mir nochmal angeschaut - ich glaube der Fehler entsteht, weil eine Zeile fehlte:

  • füge als neue Zeile location / { vor proxy_pass 127.0.0.1; ein
  • mach die Klammer wieder hin wo sie war (Sorry)

Danach mit nginx -t die Konfiguration testen. Wenn kein Fehler gemeldet wird mit nginx -s reload die Konfiguration aktivieren.

Hier ist meine Konfiguration. Ist einb wenig komplexer, weil ich seafile nicht direkt im Webroot habe (so wie hier beschrieben https://manual.seafile.com/deploy/deploy_seahub_at_non-root_domain.html). Außerdem nutze ich OnlyOffice und habe WebDav aktiviert. WebDav funktioniert bei mir komischerweise nur mit FastCGI.

# Required for only office document server
map $http_x_forwarded_proto $the_scheme {
        default $http_x_forwarded_proto;
        "" $scheme;
    }
map $http_x_forwarded_host $the_host {
        default $http_x_forwarded_host;
        "" $host;
    }
map $http_upgrade $proxy_connection {
        default upgrade;
        "" close;
    }
server {
        listen       80;
        server_name  meineDomain.spdns.org;
        rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
        server_tokens off;
        }
server {
        listen 443;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/meineDomain.spdns.org/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/meineDomain.spdns.org/privkey.pem;
        server_name meineDomain.spdns.org;
        ssl_session_timeout 5m;
        ssl_session_cache shared:SSL:5m;
        # Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
        ssl_dhparam /etc/nginx/dhparam.pem;
        # secure settings (A+ at SSL Labs ssltest at time of writing)
        # see https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-SEED-SHA:DHE-RSA-CAMELLIA128-SHA:HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS';
        ssl_prefer_server_ciphers on;
        proxy_set_header X-Forwarded-For $remote_addr;
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
        server_tokens off;
     location /seafile {
        proxy_pass         http://127.0.0.1:8000;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        proxy_set_header   X-Forwarded-Proto https;
        access_log      /var/log/nginx/seahub.access.log;
        error_log       /var/log/nginx/seahub.error.log;
        proxy_read_timeout  1200s;
        client_max_body_size 0;
        }
     location /media {
            root /home/seafile/seafile-server-latest/seahub;
        }
     location /seafdav {
        fastcgi_pass    127.0.0.1:3000;
        fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
        fastcgi_param   PATH_INFO           $fastcgi_script_name;
        fastcgi_param   SERVER_PROTOCOL     $server_protocol;
        fastcgi_param   QUERY_STRING        $query_string;
        fastcgi_param   REQUEST_METHOD      $request_method;
        fastcgi_param   CONTENT_TYPE        $content_type;
        fastcgi_param   CONTENT_LENGTH      $content_length;
        fastcgi_param   SERVER_ADDR         $server_addr;
        fastcgi_param   SERVER_PORT         $server_port;
        fastcgi_param   SERVER_NAME         $server_name;
        fastcgi_param   HTTPS               on;
        client_max_body_size 0;
        access_log      /var/log/nginx/seafdav.access.log;
        error_log       /var/log/nginx/seafdav.error.log;
        }
     location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
        }
     location /onlyofficeds {
        proxy_pass http://127.0.0.1:88/;
        proxy_http_version 1.1;
        client_max_body_size 100M; # Limit Document size to 100MB
        proxy_read_timeout 3600s;
        proxy_connect_timeout 3600s;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $proxy_connection;
        proxy_set_header X-Forwarded-Host $the_host/onlyofficeds;
        proxy_set_header X-Forwarded-Proto $the_scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Moin,
also die Fehlermeldung

Jul 25 08:35:29 raspberrypi nginx[2471]: nginx: [emerg] "proxy_pass" directive is not allowed here in /etc/nginx/sites-enabled/seahub:10

zeigt doch dass Zeile 10 in der nginx-site-config falsch ist bzw. dort nicht hingehört:

proxy_pass         http://127.0.0.1:8000;

Die gehört in den Configblock für das nginx-root, der fehlt in deiner config aus dem ersten Post aber komplett. Mir wäre neu, dass man das so schreiben kann, vermutlich ist die Zeile nur irgendwo verloren worden. (Seine schliessende Klammer ist aber noch da.) Mach aus der site-config mal dieses:

server {
    listen 8001;
    ssl on;
    ssl_certificate /etc/ssl/seahub.crt;        # path to your cacert.pem
    ssl_certificate_key /etc/ssl/seahub.key;    # path to your privkey.pem
    server_name 192.168.178.88;
    error_page 497 https://$host:$server_port$request_uri;
    server_tokens off;

location / { 
    proxy_pass         http://127.0.0.1:8000;
    proxy_set_header   Host $host:$server_port;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;
    proxy_set_header   X-Forwarded-Proto https;

    access_log /var/log/nginx/seahub.access.log; 
    error_log /var/log/nginx/seahub.error.log;
    proxy_read_timeout 1200s; 
    client_max_body_size 0;
}

location /seafhttp {
            rewrite ^/seafhttp(.*)$ $1 break;
            proxy_pass http://127.0.0.1:8082;
            client_max_body_size 0;
            proxy_request_buffering off;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_connect_timeout  36000s;
            proxy_read_timeout  36000s;
            proxy_send_timeout  36000s;
            send_timeout  36000s;
        }

        location /media {
            root /home/seafile/seafile/seafile-server-latest/seahub;
        }
 }

Das ist copypasted von deinem Beispiel plus die Zeile, die den Locationblock für / öffnet.
Anschliessend mal mit “nginx -t” testen ob es okay ist und bitte den Output hier posten.

Hallo zusammen,

ich bedanke mich für die ausführliche Hilfe. Der Server läuft nun und ich hab wieder was dazu gelernt.

Vielen Dank

1 Like