In this tutorial, you will learn how to install and configure Imgproxy on Alpine Linux. Imgproxy is an open source server that helps you to resize, crop, and rotate images on the fly. It can be easily integrated into your web applications or websites to enhance your image delivery performance.
Before starting this tutorial, you need to have the following:
Before installing any packages, update the packages list and upgrade the installed packages to their latest versions.
sudo apk update
sudo apk upgrade
Imgproxy requires some dependencies to work properly. To install them, run the following commands:
sudo apk add build-base \
openssl-dev \
libcrypto1.1 \
pkgconfig \
curl-dev \
ca-certificates
To install Imgproxy, follow these steps:
sudo mkdir /usr/local/src/imgproxy
sudo curl -L -o imgproxy.tar.gz https://github.com/imgproxy/imgproxy/releases/download/v3.0.2/imgproxy-linux-amd64.tar.gz
Note: You can check for the latest release and update the above command accordingly.
sudo tar -xzvf imgproxy.tar.gz -C /usr/local/src/imgproxy/
sudo ln -s /usr/local/src/imgproxy/imgproxy-linux-amd64 /usr/local/bin/imgproxy
imgproxy -version
If the installation is successful, you should see the Imgproxy version displayed in the output.
To configure Imgproxy, follow these steps:
sudo nano /etc/imgproxy.cfg
log_level: info
listen: 0.0.0.0:8080
ssl:
server_key: /path/to/server.key
server_cert: /path/to/server.crt
authorization:
salt: your_secret_salt
key: your_secret_key
storage:
type: s3
region: us-west-2
bucket: my-images
access_key_id: my_aws_access_key_id
secret_access_key: my_aws_secret_access_key
processing:
jpeg:
quality: 90
chroma_subsampling: "4:2:0"
webp:
quality: 90
stacks:
blog:
url: "https://www.example.com/"
process: ["resize_to_fill", 640, 480]
watermark: { url: "https://www.example.com/watermark.png" }
Note: You need to update the values according to your requirements.
Ctrl + X
, then Y
, and finally Enter.To start the Imgproxy service, run the following command:
sudo imgproxy --config /etc/imgproxy.cfg
Note: You can add the --daemonize flag to run it as a background process.
Congratulations, you have successfully installed and configured Imgproxy on Alpine Linux. You can now use it to resize, crop, and rotate images on the fly in your web applications.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!