I used Alibaba Cloud to purchase a pay-as-you-go server, the system is: centos 7, first, install the necessary package, the command is as follows:
Review:
Download nginx-1.20.1
Download using the wget command, as follows:
Unzip nginx-1.20.1
The command is as follows:
Download Nginx-image-filter-watermark
nginx-image-filter-watermark patches Nginx with watermarking. http_image_filter_module-based patches,It can convert images in JPEG, GIF, PNG, and WebP formats。
Should work fine on nginx >= 1.11.6. GitHub address:The hyperlink login is visible.
It can be understood that the ngx_http_image_filter_module module that comes with nginx does not have an image watermark function, and this module is an enhanced version of the nginx image module
ngx_http_image_filter_module:The hyperlink login is visible.
The command is as follows:
Compile and install
configure the command is as follows:
The error is as follows:
./configure: error: the HTTP image filter module requires the GD library. You can either do not enable the module or install the libraries. Install the GD library with the following command:
Re-execute the ./configure command again, and then do the following:
Turn on the image watermark
Create a site directory with the following command:
Start and restart the nginx service command (omitted).
I uploaded the image watermark watermark.png image under the /data directory. (omitted)
At the beginning of my nginx.conf configuration file, it looks like this:
image_filter_watermark_position - Watermark position, the available values are top-left|top-right|bottom-right|bottom-left|right-center|left-center|bottom-center|top-center|center-center|center-random.
I triedChange a notepad file suffix to a.jpg and upload oneBMP, HTML formatfile, or accessing a non-existent file via nginx, will report a 415 error, as shown in the figure below:
415 Unsupported Media Type
Try modifying the configuration file as follows, only blocking files in jpg, jpeg, png format:
(End)
|