Install Seafile Cloud Storage on NAT VPS


NATVPS.id – Seafile is a cloud storage system open source for file synchronization, sharing, and document collaboration. Seafile could be an alternative to the service cloud storage such as Google Drive or OneDrive. With Seafile, you have complete control over the data you store.

This article discusses the steps to install Seafile on a NAT VPS using Docker, along with NGINX configuration for reverse proxy. This article uses Ubuntu 22.04 as a reference, but you can use other distributions such as Debian and CentOS. Make sure the OS used supports Docker.

Port Forwarding Configuration

Considering we are using NAT, we need to add 2 port forwarding configurations on the Virtualizor panel (or other VPS panel according to provider), ie HTTP and HTTPS port forwarding For Seafile Domains.

For example, in this article we will use a domain sf.tutorial.mdinata.my.id to access Seafile. You are free to change the domain according to your choice. Note this port and domain, because we will use them again in the installation process.

Don’t forget to add a DNS record that goes to your VPS’ NAT public IP, like this:

If you are confused, please read our article regarding domain forwarding here: Explanation of Domain Forwarding in NAT VPS.

Install Docker

We will use docker and write docker for spread Personal b.

First, Install curly using order:

apt update && apt install curl -y

Then, run script automatic installation of Docker by entering:

curl -fsSL get.docker.com | sh

Wait until the installation process is complete.

Install Seafile

First, create a new folder for seafile.

mkdir /opt/seafile
cd /opt/seafile

Download the Docker Compose configuration as well as the ENV Seafile:

# Env file


# Seafile server
wget 
wget 

The default Env and Docker Compose configurations are taken from the author’s repository, which has been changed to run Seafile without Caddy, since we will be using NGINX as a reverse-proxy.

Change the configuration first .env before starting Seafile:

apt install nano -y # Jika belum
nano .env

Some configurations to note:

  • JWT_PRIVATE_KEY: Private key >= 32 characters long for authentication. To create it, enter the command pwgen -s 40 1
  • SEAFILE_SERVER_HOSTNAME: Your Seafile server address. Adapt it to your domain, for example: sf.tutorial.mdinata.my.id
  • SEAFILE_SERVER_PROTOCOL: https
  • INIT_SEAFILE_ADMIN_EMAIL: Admin email for first login. Replace with your Email
  • INIT_SEAFILE_ADMIN_PASSWORD: Admin password for first login
  • SEAFILE_VOLUME: Seafile data location. Adjust if necessary
  • TIME_ZONE: Timezone. Can be changed to Asia/Jakarta.

Save the file with Ctrl-X, yThen Enter.

Finally, run Seafile:

docker compose up -d

Wait until the process spread finished. The first deployment may take a few minutes due to the entire download picture Seafile and configure receptacle from the beginning.

If so, check the Docker Compose log to ensure Seafile has run successfully.

NGINX (Reverse Proxy) Configuration

So that we can access URLs via domains such as sf.tutorial.mdinata.my.idwe can use reverse proxy like NGINX.

First, install NGINX via command:

# Hapus Apache2 dan pendukungnya (biasanya terpasang secara bawaan di VPS OpenVZ)
apt purge apache2* -y

# Install NGINX
apt install nginx -y

Create a new host configuration specifically for Seafile:

nano /etc/nginx/sites-available/seafile

Then paste the following configuration:

# 

server {
    server_name sf.tutorial.mdinata.my.id;
    listen 80;
    listen [::]:80;

    location / {
        proxy_pass 
        proxy_read_timeout 310s;
        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 Connection "";
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Forwarded-Proto https;
        proxy_http_version 1.1;

        client_max_body_size 0;
    }

    location /sdoc-server/ {
        proxy_pass         
        proxy_redirect     off;
        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;

        client_max_body_size 100m;
    }

    location /socket.io {
        proxy_pass 
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_redirect off;

        proxy_buffers 8 32k;
        proxy_buffer_size 64k;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
    }
}

Change sf.tutorial.mdinata.my.id with your domain.

Activate the configuration by:

ln -sf /etc/nginx/sites-available/seafile /etc/nginx/sites-enabled/seafile

systemctl restart nginx # Restart NGINX

Generate SSL Certificate (Let’s Encrypt)

In order for our domain to be accessible via HTTPS, we need to create an SSL certificate. We can use a free SSL certificate from Let’s Encrypt via Certbot.

Install Certbot and its NGINX plugin use the command:

apt install python3-certbot python3-certbot-nginx

So, produce certificate via Certbot with command

certbot --nginx -d sf.tutorial.mdinata.my.id

Change sf.tutorial.mdinata.my.id with your domain.

Happy! Your domain is currently accessible via a secure HTTPS connection.

Accessing Seafile

Seafile can be accessed through your previous domain. Example: https://sf.tutorial.mdinata.my.id.

Login with the Email & password that you have set in the ENV file.

Congratulations, Seafile is ready to use!

Cover

That’s the end of this article regarding the steps to install Seafile on a NAT VPS. If you are confused or in doubt, don’t hesitate to ask in the Telegram group @IPv6Indonesia. Thank You!


News
Berita
News Flash
Blog
Technology
Sports
Sport
Football
Tips
Finance
Berita Terkini
Berita Terbaru
Berita Kekinian
News
Berita Terkini
Olahraga
Pasang Internet Myrepublic
Jasa Import China
Jasa Import Door to Door