How to deploy a self-hold image sharing website

You will learn how to deploy a self-hold image sharing website in this post. Due to this time I am using a new VPS(my newly brought VPS with a huge storage–2TB at first and 3GB daily increase), the nginx config setting path will be different from the previous post.

log in your VPS as root.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
apt update
apt upgrade
apt install docker.io
apt install nginx
apt install python3-certbot-nginx
apt install certbot
docker run -d \
--name lsky-pro \
--restart unless-stopped \
-p 8089:8089 \
-v $PWD/lsky:/var/www/html \
-e WEB_PORT=8089 \
halcyonazure/lsky-pro-docker:latest
certbot certonly --nginx -d your_domain.com
vim /etc/nginx/sites-available/default
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/letsencrypt/live/your_domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/your_domain.com/privkey.pem;
server_name your_domain.com;
location / {
proxy_pass http://127.0.0.1:8089;
client_max_body_size 1024m; # This is the most important for your large image file upload.
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-Proto https;
add_header X-Cache $upstream_cache_status;
}
}
1
service nginx restart

Then you can just go to the website with your domain and do the initiation following by the instruction. Done.