Tom

Tom

Docker deployment of Lankong image hosting

Docker Deployment of Lsky Image Hosting#

Recently, the VPS for the image hosting expired, and during the migration, I found that the original open-source version of the Chevereto image hosting Docker version was simply gone, and the repository was deleted, forcing a payment. Therefore, I was fortunate to switch to a domestic alternative. Although the open-source version of Lsky Image Hosting is no longer updated, at least the Docker version can be pulled, and it works fine for personal use without MySQL, which is definitely a priority for small machines.

1. Pulling the Docker Image#

Image address: https://github.com/HalcyonAzure/lsky-pro-docker

I used Docker Compose for deployment without MySQL, using SQLite instead. For any other changes, you can refer to the Docker Compose file in the author's repository.

To explain the ports, I have them a bit mixed up here; HTTPS_PORT is the port for HTTPS, and WEB_PORT is the port for HTTP. The HTTPS port comes with a self-signed certificate by default. I am using NGINX to proxy the WEB_PORT, and currently, there are no issues. Normally, according to the manual, NGINX should connect to the HTTPS_PORT, so please pay attention to the distinction.

version: '3'
services:
  lskypro:
    image: halcyonazure/lsky-pro-docker:latest
    restart: unless-stopped
    hostname: lskypro
    container_name: lskypro
    environment:
      - HTTPS_PORT=8088
      - WEB_PORT=8089
    volumes:
      - $PWD/web:/var/www/html/
    ports:
      - "9080:8088"
      - "9081:8089"
    networks:
      - lsky-net

2. Configuring NGINX to Enable HTTPS#

My NGINX configuration file

server {
        listen 443 ssl;
        server_name xxx.com;       
        # Certificate
        ssl_certificate      /root/.acme.sh/xxx.com_ecc/xxx.com.cer;
        ssl_certificate_key  /root/.acme.sh/xxx.com_ecc/xxx.com.key;
        access_log /var/log/nginx/lskylog/access.log main;
        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host $host;
            proxy_pass http://127.0.0.1:9081;
            proxy_redirect off;
            client_max_body_size 100m;
            client_body_buffer_size 128k;
          }        
    }

The line “client_max_body_size 100m;” is to prevent NGINX from interrupting the transmission due to oversized image uploads. This container has modified the upload limit in the php.ini file by default, but if you still encounter errors when uploading images of a few megabytes, you need to consider whether the limitation is caused by NGINX.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.