Nginx config for Seafile 7.1.5 on Debian 10 running Virtualmin control panel

I’m still trying to install Seafile on a Debian 10 system which is running the Virtualmin control panel and Nginx. I’m not very savvy with Nginx and I think that might be where my troubles lie.

With my Virtualmin setup of Debian 10, I have php-fpm listening to port 8000.

So I had to figure out how to get seahub running as it was unable to start up with Seafile 7.1.5. I found a workaround to get seahub on port 8085 by:

  • adding a user seafileu and installing Seafile 7.1.5 in that user’s directory
  • replacing port 8000 with port 8085 in:
    • vi …/conf/gunicorn.conf.py
    • vi …/conf/ccnet.conf

After changing the port numbers in those two files to 8085, I could then:
./seafile.sh start
./seahub.sh start 8085

netstat -tunlp shows
tcp 0 0 0.0.0.0:8082 0.0.0.0:* LISTEN 1247/seaf-server
tcp 0 0 127.0.0.1:8085 0.0.0.0:* LISTEN 1282/python3

ss -tunlp4 shows:
tcp LISTEN 0 128 0.0.0.0:8082 0.0.0.0:* users:((“seaf-server”,pid=2048,fd=16))
tcp LISTEN 0 128 127.0.0.1:8085 0.0.0.0:* users:((“python3”,pid=2453,fd=6),(“python3”,pid=2452,fd=6),(“python3”,pid=2451,fd=6),(“python3”,pid=2450,fd=6),(“python3”,pid=2449,fd=6),(“python3”,pid=2445,fd=6))
t

So I think seafile/seahub are up and running and listening on ports 8082/8085.

My /etc/nginx/nginx.conf file includes files in /etc/nginx/conf.d

That’s where /etc/nginx/conf.d/seafile.conf is. Currently it is:

server {
listen 80;
listen [::]:80;
server_name krishnify.com;
autoindex off;
client_max_body_size 100M;
access_log /etc/nginx/seafile.com.access.log;
error_log /etc/nginx/seafile.com.error.log;

 location / {
        proxy_pass         http://127.0.0.1:8085;
        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 /docs {
        rewrite ^/docs(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        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/seafileu/seafile-server/seahub;
    }

}

. . . . .

When I visit http://krishnify.com/docs, I get a Nginx Not found page.

Does anyone more savvy with Nginx have any tips for me?

Thanks,

First of, you are mistaken to call the file server’s URL in order to reach the webinterface. The webinterface is Seahub and you configured to run seahub on port 8085. Hence, you need to visit http :// krishnify.com

But this won’t work because there are at least two other issues:

a.) Port 8085 does not seem to be accessible. I ran a port scan and it told me “port closed”. Has Seahub really started? Is the firewall properly configured?
b.) Where does this instruction come from?

Seafile does not know a folder /docs. This must be /seafhttp

Thanks for your help.

I’m not sure if I would use http://krishnify.com. I do want to reserve a website at that address in the future. Perhaps docs.krishnify.com is what I want to insert in the Nginx server_name and in the Seafile config files?

I forgot entirely about configuring the firewall for the new ports!

However, upon attempting a firewalld --reload, an error occurs and the port is unable to be open.
Error: COMMAND_FAILED: ‘/usr/sbin/ip6tables-restore -w -n’ failed: ip6tables-restore v1.8.2 (nf_tables):

I will have to do some troubleshooting to get firewalld to successfully open that port. Or use another firewall that will.

Thanks for the tip about seafhttp. With all the various Seafile Nginx config files floating around, I didn’t know what was variable in those files.

Sure. You can do that. Based on your nginx config above, it seemed you wanted to run Seafile directly under the top-level domain. And this was the basis for my comment.

Yeah, I was mixing the two. I will use the subdomain approach.

Will post further developments once I can get the port open.

Please mark this topic as solved. The problems have been identified.

Can I leave it open until I get Seafile working?

Also, if I stipulate docs.krishnify.com, do I have to setup a DNS record?

I’m noticing that ./seafile.sh start opens port 8082 upon successful execution without me having to do anything.

I wonder where in the script that seafile does that?

However, I did modify seahub to try to run on port 8085. And even though I issued a ./seahub.sh start 8085 command, it does not open that port.

I wonder if anyone knows where in the seahub start script it tries to open port 8000/$port?

It could be somewhere in /seafile-server/seahub/thirdpart, possibly within the gunicorn code.

I ask because I’m not having much luck opening port 8085 with a nftables command, so trying to see if seahub will open port 8085 on its own.