Changing Seafile default port (443) in CentOS

Assuming that your installation uses nginx (which auto configuration script you are talking about?), you could go to nginx directory (/etc/nginx/).

I’m not sure how it is with CentOS, but I assume that it’s the same as debian, so you should have there a directory tree like this:

root@bananapi:~# tree -d /etc/nginx /etc/nginx ├── conf.d ├── modules-available ├── modules-enabled ├── sites-available │ ├── default │ ├── seafile.conf ├── sites-enabled ├── snippets └── ssl
You will have to backup and open the file: “seafile.conf” (or whatever it is called in your case) in /etc/nginx/sites-available (see tree above) and change the port 443 within this file to what you need:

root@bananapi:~# nano /etc/nginx/sites-available/seafile.conf

server {
listen 80;
server_name your-dns-adress;
return 301 https://$http_host$request_uri;
}

server {
listen 443 http2;
server_name your-dns-adress;
ssl on;
ssl_certificate /etc/nginx/ssl/seafile.crt;
ssl_certificate_key /etc/nginx/ssl/seafile.key;

proxy_set_header X-Forwarded-For $remote_addr;
    location / {
    fastcgi_pass    127.0.0.1:8000;

.
.
.

Just change the port number that I marked bold.

save the file and restart nginx via (I think this command working for CentOS):

service nginx restart

Then should be able to reach seahub at the new port if you have forwarded it in your router.

1 Like