How to Install Imgproxy on Ubuntu Server Latest

Introduction

Imgproxy is an open-source image processing and optimization server which is designed to securely deliver high-quality images faster. In this tutorial, we will discuss how to install Imgproxy on Ubuntu Server Latest.

Prerequisites

Step 1: Update the System

First, update the Ubuntu system with the following command:

$ sudo apt update && sudo apt upgrade -y

Step 2: Install Required Dependencies

To install Imgproxy, we need to install some prerequisites on our system. We can install them with the following command:

$ sudo apt install build-essential libmagic-dev libpng-dev libjpeg-dev libwebp-dev zlib1g-dev libtiff-dev libgif-dev pkg-config

Step 3: Download Imgproxy

We need to download Imgproxy from its official website. To download it, execute the following command on your Ubuntu server:

$ curl -LO https://github.com/imgproxy/imgproxy/releases/download/v2.15.1/imgproxy-linux-amd64

Step 4: Install Imgproxy

After downloading the Imgproxy binary file, we need to copy it to the /usr/sbin/ directory with the following command:

$ sudo cp imgproxy-linux-amd64 /usr/sbin/imgproxy

Now, we will set the correct permissions on the Imgproxy binary file using the following command:

$ sudo chmod +x /usr/sbin/imgproxy

Step 5: Create a Configuration Directory

Next, we will create a directory for Imgproxy configuration files:

$ sudo mkdir /etc/imgproxy/

Step 6: Create the Configuration File

After creating the Imgproxy configuration directory, let us create a configuration file by typing this command:

$ sudo nano /etc/imgproxy/imgproxy.conf

Put the following configurations in the configuration file:

listen: 0.0.0.0:8080

# Source image URL validation
source_url: <https://example.com/*>

# Imgproxy signature key
key: YOUR_SECRET_KEY

# Imgproxy signature salt
salt: YOUR_SECRET_SALT

# JPEG compression quality
jpeg_quality: 75

# PNG compression level
png_compression_level: 6

# JPEG/WebP maximum pixel density
max_pixel_density: 5000000

# Enable proxying to remote hosts
allow_remote: false

# Output format
output_format: webp

Make sure to replace example.com with your domain name and set a secure random string as your secret key and salt.

Step 7: Create a Systemd Service

Next, we will create a Systemd service to start Imgproxy automatically on boot. Create a new systemd service file by typing:

$ sudo nano /etc/systemd/system/imgproxy.service

Add the following content:

[Unit]
Description=imgproxy image processing and optimization server
After=network.target

[Service]
User=root
Group=root
WorkingDirectory=/etc/imgproxy/
ExecStart=/usr/sbin/imgproxy -config /etc/imgproxy/imgproxy.conf
Restart=on-failure

[Install]
WantedBy=multi-user.target

Save and close the file.

Step 8: Enable and Start the Service

The last step is to enable the Imgproxy service and start it using the following commands:

$ sudo systemctl daemon-reload
$ sudo systemctl enable imgproxy
$ sudo systemctl start imgproxy

Check the status of the service with:

$ sudo systemctl status imgproxy

If everything is set up correctly, Imgproxy should be up and running.

Conclusion

In this guide, we have discussed how to install Imgproxy on Ubuntu Server Latest. Now you can configure Imgproxy as per your requirement and start using it to optimize and securely deliver your images at high speed.

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!