imgproxy is an open-source image processing server that allows you to resize, crop, and compress images on the fly. Installing imgproxy server on your operating system will enable your web application to use a fast and reliable image resizing service. This tutorial will guide you through the step-by-step installation of imgproxy on POP! OS Latest.
Before you begin, ensure that you have the following:
sudo
privilegesFirst, we need to install some dependencies that imgproxy requires. Open the terminal and execute the following command:
$ sudo apt-get update
$ sudo apt-get install libvips libvips-dev libpng-dev libwebp-dev pkg-config build-essential
Go to the imgproxy website and download the latest release binary. To download the binary, you could use the following command:
$ wget https://github.com/imgproxy/imgproxy/releases/latest/download/imgproxy-linux-amd64
Make the binary file executable:
$ chmod +x imgproxy-linux-amd64
The next step is to move the binary to the system’s local binary directory, which is /usr/local/bin
. Execute the following command in the terminal:
$ sudo mv imgproxy-linux-amd64 /usr/local/bin/imgproxy
After successfully installing imgproxy, we need to ensure that it’s installed correctly. Execute the following command to check whether imgproxy is installed or not:
$ imgproxy -version
The output should show the version number of imgproxy.
We now need to create a configuration file that will tell imgproxy the location of the source images and the transformation options. In the terminal, execute the following command:
$ sudo nano /etc/imgproxy.toml
Copy and paste the following configuration into the file:
# The address and port imgproxy will bind to.
address = "127.0.0.1:8080"
[source]
# Filesystem source where the original images are stored.
# The `root` value is a required parameter.
type = "filesystem"
root = "/path/to/your/images/"
[server]
# Max width or height of an image. Larger images will be scaled down.
max_image_size = 8000
# Max amount (in bytes) for an image that can be retrieved from the source.
max_src_filesize = 5000000
# Max amount (in bytes) for an image that can be retrieved at 1x resolution
max_cache_filesize = 2500000
Replace /path/to/your/images/
with the path to your original images.
Press "ctrl+O" to save the file, and then "ctrl+X" to close the editor.
We will now create a systemd service that will automatically start imgproxy on boot.
Create the service file by appending the following in the terminal:
$ sudo nano /etc/systemd/system/imgproxy.service
Copy and paste the following configuration into the file:
[Unit]
Description=imgproxy
[Service]
ExecStart=/usr/local/bin/imgproxy -config /etc/imgproxy.toml
[Install]
WantedBy=multi-user.target
Press "ctrl+O" to save the file, and then "ctrl+X" to close the editor.
After creating the file, reload systemd:
$ sudo systemctl daemon-reload
And start the imgproxy service:
$ sudo service imgproxy start
To enable the imgproxy service on boot, execute the following command:
$ sudo systemctl enable imgproxy
By default, imgproxy binds to 127.0.0.1:8080
. We need to open the port on the firewall if we intend to use the service over the network.
$ sudo ufw allow 8080/tcp
In this tutorial, we walked through the configuration and installation of imgproxy on POP! OS Latest. You’re now ready to use imgproxy as an image processing server in your web application.
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!