How to install lsky with Apache2

As I installed Nextcloud before, I have changed my web server from Nginx to Apache2. So I need to re-deploy my lsky, which is my image sharing webpage as these two web server can not be used in the same time as far as I know.

How

The first part is the same with the previous tutorial

log in your VPS as root.

1
2
3
4
5
6
7
8
9
10
apt update
apt upgrade
apt install docker.io
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

The difference part

1
2
3
4
apt install apache2
apt install certbot python3-certbot-apache
cd /etc/apache2/sites-available/
vim lsky.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<VirtualHost *:80>
ServerName your.domain

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>

<VirtualHost *:443>
ServerName your.domain

# Comment below SSL setting before you get the SSL cerficate, and uncomment these after get the certificate
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/your.domain/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/your.domain/privkey.pem

ProxyPass / http://127.0.0.1:8089/
ProxyPassReverse / http://127.0.0.1:8089/

# Set the maximum allowed size for the client request body
LimitRequestBody 1024000000

# Headers to pass to the backend server
#RequestHeader set Host $host This line is not needed, or it will occur 404 error
RequestHeader set X-Real-IP $remote_addr
RequestHeader set X-Forwarded-For $proxy_add_x_forwarded_for
RequestHeader set REMOTE-HOST $remote_addr
RequestHeader set X-Forwarded-Proto https

</VirtualHost>
1
2
3
4
5
6
7
a2ensite lsky.conf
systemctl reload apache2
certbot certonly --apache -d your.domain
a2enmod ssl
a2enmod proxy
a2enmod proxy_http
service apache2 restart