Open jamminjames opened 6 years ago
You need to compile it with nginx with the --add-module
flag.
See this link for an example
My nginx is version 1.14.0. However, I had already installed without having compiled. How could I add it without having to compile again. Since my current site is up and running and I have already made many settings. Would you like to indicate something? Thanks in advance.
CentOS 7 instructions (requires subscription):
yum install https://extras.getpagespeed.com/release-el7-latest.rpm
yum install nginx-module-cache-purge
To enable this module, add the following to /etc/nginx/nginx.conf and reload nginx:
load_module modules/ngx_http_cache_purge_module.so;
yum install nginx-module-cache-purge
Anything similar for apt (debian/ubuntu)?
I'm in the same boat here, re-compiling from scratch my production nginx binary which already has a lot of config and modules with it sounds like a daunting task but I would like to use this purge plugin without having to wipe and re-compile the entire nginx install.
@emmm-dee easier thing you can do in lack of repository for apt is compiling the dynamic module file yourself and then dropping it to your nginx. You don't need to scratch/recompiling the whole of your existing nginx installation for this.
Steps:
./configure --add-dynamic-module=/path/to/ngx_cache_purge --with-compat
make
Those steps are better run on a separate machine, not to pollute your system with build requirements. (Although it's really just gcc
and make
for the most part).
Once the compilation is done, you'll have the ngx_http_cache_purge_module.so
somewhere in objs
subdirectory when it's done compiling. Then you can use that by placing it to Nginx's modules directory and using load_module
like above.
compiling the dynamic module file yourself and then dropping it to your nginx. You don't need to scratch/recompiling the whole of your existing nginx installation for this.
@dvershinin Thanks! That's extremely helpful. All other guides said to run make modules
after running configure which just returned a make[1]: Nothing to be done for 'modules'
but just a straight make
does seem to get the job done, but it compiles a .o
not a .so
output for the module.
So after ./configure
step I see that it added it properly:
adding module in ./ngx_cache_purge
+ ngx_http_cache_purge_module was configured
Then after running make
it did compile a .o
file but not a .so
root@f2c92f9f3c5b:/nginx-1.14.2/objs/addon/ngx_cache_purge# ls -l
total 184
-rw-r--r-- 1 root root 185728 Aug 14 15:04 ngx_cache_purge_module.o
Any ideas on why I'm not getting the .so
output? Your help is very much appreciated.
@emmm-dee I should have mentioned that this Github repository's config
file is for building module only statically. So your module has been compiled into nginx
binary now.
To get it to compile into .so
instead, you must either update the config
manually or (of course), use a fork where they already did so.
This fork has config
file updated with the ability to compile the module as dynamic. You should be able to just copy their config
and overwrite existing one, then make clean && ./configure (with your ags) && make modules
.
It is correct that make modules
is better in this situation, because it only compiles modules.
Simply make
will compile NGINX itself (unnecessary for you) and modules .
@dvershinin success! Thanks for taking the time to explain this!
Now I just hope the plugin works as expected :)
root@f2c92f9f3c5b:/nginx-1.14.2/objs# ls -l ngx_http_cache_purge_module.so
-rwxr-xr-x 1 root root 115432 Aug 14 15:59 ngx_http_cache_purge_module.so
@emmm-dee as long as you did configure with --with-compat
, it should be fine :)
You're welcome.
Is the only way to get extras.getpagespeed to pay $10/month? I get errors (Error importing repomd.xml for getpagespeed-extras-mainline: Damaged repomd.xml file) trying to install it, and researching I found this page, saying you have to subscribe: https://www.getpagespeed.com.
The point of subscription is easy updates and there’s far more than this module available.
Other ways:
Getpagespeed repo is free for CentOS/RHEL 8 as of this writing so is also an option.
Okay, I'm sure it's worth it, just on an extremely tight budget here.
Just curious, why is it free for CentOS/RHEL 8? I have CentOS 7.
Things are still quite in flux with CentOS 8:
That said, most of NGINX modules for stable NGINX branch are available; fewer for mainline.
As far as CentOS 7: many folks just subscribe, install what they need and unsubscribe to avoid billing on next month, if they don't care about continuous update availability.
I don't see any explanation of how to install this on a server and get it to work with a nginx installation...