Quantcast
Channel: KhamDB
Viewing all articles
Browse latest Browse all 10

INSTALL THE NGX_CACHE_PURGE MODULE IN NGINX

$
0
0

Ngx_cache_purge is a module which will allow the fastcgi_cache, proxy, SCGI and uWSGI caches to have content purged from them. The caches allow precompiled code to be served as opposed to running a new version each time. This can greatly reduce the amount of processing power per page request.  This specific module allows that cached content to be purged when needed.  To compile this module from source if you have done a source build of Nginx like this Nginx Compile From Source On CentOS. Adding the module is pretty straightforward. You can read more about the module here

First get the ngx_cache_purge package

wget -O /usr/src/ngx_cache_purge-2.3.tar.gz  http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz

Uncompress the package

tar xfvz ngx_cache_purge-2.3.tar.gz

cd to your Nginx build directory

cd /usr/src/nginx-1.11.13

Get the prior build configuration options

# nginx -V
 nginx version: nginx/1.11.13
 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
 built with OpenSSL 1.0.1e-fips 11 Feb 2013
 TLS SNI support enabled
 configure arguments: --user=nginx --group=nginx --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-file-aio --with-http_realip_module --without-http_scgi_module --without-http_uwsgi_module --with-http_realip_module

Copy all of the configure arguments and append –add-module=/path/to/ngx_cache_purge

./configure --user=nginx --group=nginx --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-file-aio --with-http_realip_module --without-http_scgi_module --without-http_uwsgi_module --with-http_realip_module --add-module=/usr/src/ngx_cache_purge-2.3

Once configure has finished, You can go ahead perform  a make and install it

make

make install

Then restart nginx

/etc/init.d/nginx restart

Run the following to ensure the module is now loaded:

nginx -V 2>&1 | grep ngx_cache_purge -o

It should return ngx_cache_purge if it is.

That is all you need to do to add the module to a Nginx build.

Source: https://linuxadmin.io/add-ngx_cache_purge-module-to-nginx/

Bài viết INSTALL THE NGX_CACHE_PURGE MODULE IN NGINX đã xuất hiện đầu tiên vào ngày KhamDB.


Viewing all articles
Browse latest Browse all 10

Trending Articles