[solved] Seafile 7.05 on Raspberry Pi with Raspbian, NGINX won't start

Hello everybody,

this is my second time of setting up seafile server on a raspberry pi 2b, the first time, once it worked, I had it run for more than three years without problems. When my old router broke two weeks ago, I wanted to let it run from an attached SSD. The booting of Raspbian works, but so far no tangible success with the server installation or any attempts at reaching seahub via a webpage. I then continued with getting the let’s encrypt keys and was configuring nginx when I ran into problems I cannot solve without help.

So the setup is with NGINX and sqlite with https, the keys are from let’s encrypt. Obviously, I want to be able to connect to seafile server via the internet (so not just LAN). The document I used for help with the nginx config is this one:

https://download.seafile.com/published/seafile-manual/deploy/https_with_nginx.md

Basically, I copied and pasted the first config file unter the heading " Modify Nginx configuration file".
As it says " Assume you have configured nginx as Deploy-Seafile-with-nginx. To use https, you need to modify your nginx configuration file.", I at first used the much longer config file from the other page (deployment without https) and added the parts that had to be changed (server address and location of certificates), but when I ran into problems I tried the much shorter example from the website about deployment with https, with no success, unfortunately.

So my config file (seafile.conf in /etc/nginx/sites-available) looks like this currently:

server {
    listen       80;
    server_name  PUBLIC_IP.net;
    rewrite ^ https://$http_host$request_uri? permanent;	# force redirect http to https
    # Enables or disables emitting nginx version on error pages and in the "Server" response header field.
    server_tokens off;
}
server {
    listen 443;
    ssl on;
    ssl_certificate /etc/letsencrypt/live/PUBLIC_IP.net/fullchain.pem;    	# path to your cacert.pem
    ssl_certificate_key /etc/letsencrypt/live/PUBLIC_IP.net/privkey.pem;	# path to your privkey.pem
    server_name PUBLIC_IP.net;
    server_tokens off;
    # ......
    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;
    proxy_read_timeout  1200s;
}

Then I tried to restart nginx (I also tried “load”, but there is an error message, too), with the following result:

pi@raspberrypi:~ $ sudo /etc/init.d/nginx restart
[....] Restarting nginx (via systemctl): nginx.serviceJob for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
 failed!

Checking with “systemctl status nginx.service” gives the following info:

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 2019-11-27 15:22:28 CET; 50s ago
     Docs: man:nginx(8)
  Process: 20840 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Nov 27 15:22:28 raspberrypi systemd[1]: Starting A high performance web server and a reverse proxy server...
Nov 27 15:22:28 raspberrypi nginx[20840]: nginx: [emerg] unknown directive "<U+FEFF>server" in /etc/nginx/sites-enabled/seafi
Nov 27 15:22:28 raspberrypi nginx[20840]: nginx: configuration file /etc/nginx/nginx.conf test failed
Nov 27 15:22:28 raspberrypi systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Nov 27 15:22:28 raspberrypi systemd[1]: nginx.service: Failed with result 'exit-code'.
Nov 27 15:22:28 raspberrypi systemd[1]: Failed to start A high performance web server and a reverse proxy server.
lines 1-12/12 (END)

ccnet.conf

[General]
USER_NAME = RaspbySeafile
ID = b484e549231883044bdbd7fb0a27ea4f0ccc4e2e
NAME = RaspbySeafile
SERVICE_URL = https://PUBLIC_IP.net
[Client]
PORT = 13419

seafile.conf:

[fileserver]
port=8082

seahub_settings.py:

# -*- coding: utf-8 -*-
SECRET_KEY = "MY_KEY"
FILE_SERVER_ROOT = 'https://PUBLIC_IP.net/seafhttp'

gunicorn.conf:

import os
daemon = True
workers = 5
# default localhost:8000
bind = "0.0.0.0:8001"
# Pid
pids_dir = '/home/seafile/haiwen/pids'
pidfile = os.path.join(pids_dir, 'seahub.pid')
# for file upload, we need a longer timeout value (default is only 30s, too sho$
timeout = 1200
limit_request_line = 8190

I googled for “nginx unknown directive server”, but with no really helpful results. It would be great if someone had an idea of what the problem might be.

I realized that the problem had to be an nginx installation problem, finally installing it everything again by removing the installation following these instructions helped:
https://www.youtube.com/watch?v=rSUeIeny8B0