current position:Home>Openresty+nginx image server configuration, add http_image_filter_module module
Openresty+nginx image server configuration, add http_image_filter_module module
2022-08-06 17:27:20【Yin Changqing】
Background
Pure NGINX configuration image server please refer to: Nginx picture and video server configuration_Yin Changqing's blog-CSDN blog
Openresty itself does not have an integrated image module by default, you need to manually compile the openresty method to add the module.
openresty download address, if openresty has been installed on the machine before, it is best to go to the official website to download the corresponding openresty source code
Deployment
Download
Official website address: OpenResty - Download
Compile openresty
tar -zxvf openresty-1.19.9.1.tar.gzcd openresty-1.19.9.1
Install the tools required for compilation
yum -y install gcc pcre-devel make zlib-devel openssl-devel libxml2-devel libxslt-devel gd-devel GeoIP-devel libatomic_ops-devel luajit luajit-devel perl-develperl-ExtUtils-Embed
Compile source code
First check what the original openresty installed
/usr/local/openresty/nginx/sbin/nginx -V
This will appear
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.20 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.10 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-stream--with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module
When we compile, we only need to bring the data of --with-xxxxx, and add the module http_image_filter_module
Example:
./configure --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module --with-http_image_filter_module
Appears when configuration is complete
Type the following commands to build and install:gmakegmake install
Then execute
gmake && gmake install
It will appear when the execution is complete
gmake[2]: leave directory "/home/openresty-1.19.9.1/build/nginx-1.19.9"gmake[1]: leave directory "/home/openresty-1.19.9.1/build/nginx-1.19.9"mkdir -p /usr/local/openresty/site/lualib /usr/local/openresty/site/pod /usr/local/openresty/site/manifestln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/openresty/bin/openresty
At this time, when you execute nginx -V, you will find that the image module has been added successfully. If there is an error in the process, there are probably few tools. It can be solved by installing the few tools with yum.
The next step is to configure nginx.conf and restart openresty
location ~ /img/(.*)_(\d+)x(\d+)(.*)$ {root /;rewrite ^/img/(\S)(\S)(.*)_(\d+)x(\d+)(.*)$ /home/imgs/$1$2/$3$6 break;image_filter resize $4 $5;image_filter_buffer 50M;image_filter_jpeg_quality 75;}# The regular processing link /img/F166666666_240.jpg will point to the local path /home/img/F1/66666666.jpg file# The picture will be scaled according to the width of 240, and the compression rate will be 75location ~ /img/(.*)_(\d+)(\.(.*))$ {root /;rewrite ^/img/(\S)(\S)(.*)_(\d+)(\.(.*))$ /home/imgs/$1$2/$3$5 break;image_filter resize $4 -;image_filter_buffer 50M;image_filter_jpeg_quality 75;}# The regular processing link /img/F166666666.jpg will point to the local path /home/img/F1/66666666.jpg filelocation ~ /img/(.*)$ {root /;rewrite ^/img/(\S)(\S)(.*)$ /home/imgs/$1$2/$3 break;}
Save reboot.
copyright notice
author[Yin Changqing],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/218/202208061703170641.html
The sidebar is recommended
- Understand the location and root nginx
- Alibaba Cloud nginx configuration file does not take effect
- Men "powerless" don't blame electric cars
- java project recommendation - based on springboot+vue car rental system 296
- Shared charging treasure management system based on springboot+vue
- Reprint--Several recommended practices for JavaScript asynchronous code
- Web version face recognition, face login, face comparison, springboot+vue+mysql
- Web version face login, web face login, face recognition, based on Springboot+vue2.X version+mysql
- Nodejs knowledge that the front end needs to know (basic)
- AngularJS uses ng-class, ng-style to achieve dynamic css style
guess what you like
vue drop down menu
Nginx proxy_set_header parsing and stretches add_header instruction [go]
Vue study notes (middle)
Vue study notes
Vue study notes (below)
Escaping and escaping strings json, xml, html escaping and escaping tools StringEscapeUtils
Django website development 01.Web website and front-end HTML tags
Django website development 02. CSS Cascading Style Sheets (Cascading Style Sheets)
(Front-end) Application of "Memo" design pattern in project development
Javascript paging: simulate the method of returning data in the background
Random recommended
- How to use wireless serial communication module to realize long-distance communication between touch screen and PLC?
- Getting Started with Vue2 - Rookie Level 1
- HTTP and HTTPS protocols
- 2022 Autumn Recruitment Front-end Interview Questions (1) (with answers)
- From function computing to serverless architecture
- Before 2022 the autumn recruit face questions (with answers) (2)
- About git's fatal: unable to access 'https://gitee.com/': Could not resolve host: gitee.com; Unknown error
- The sinkhole of Nginx's current limit!!
- Write a progress bar in JavaScript
- Write input box validation in JavaScript
- CSS knowledge points
- Write a random color in JavaScript
- Construct HTTP
- Webstorm opens and browses md files with garbled characters?
- PHP+HTML+MySQL realizes login error
- The comments in the Dygraphs Annotations
- [React] Part VI Life Cycle
- [React] Part VII Dom's diffing algorithm
- To React the React in the setState after data didn't change
- [React] The problem of React project startup stuck in Starting the development server...
- [React] The eighth part of react scaffolding installation and react scaffolding configuration agent
- [React] Part 5 Higher-Order Functions and Currying of Functions
- form and CSS
- In the Vue named Vue 】 【 encountered when component name "index" should always be multi - solution of word
- A pit in Nginx forwarding, operation and maintenance actually let me take the blame
- Easily converts HTML to PDF BFO Publisher
- vue2 typescript style type error?
- The back-end json is transferred to the front-end, but the front-end does not display?
- The sinkhole of Nginx current limit
- nginx service upgrade
- Vue gets the width and height attributes of the file file
- html submit form does not jump to the page
- CSS Tricks You Need to Know: Images
- Huawei FreeBuds Pro 2 review: the strongest TWS is here, this is the ceiling of wireless headphones
- Docker deploys a single page application
- Nginx and CDN
- vue click.stop stops the click event from continuing to propagate (stops the event from bubbling up)
- js array to remove the specified element [function encapsulation] (including object array to remove the specified element)
- CSS Drawing [Summary]
- [Webpack Quick Start] How to manually configure a webpack packaging tool for the project?