Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you install this module? #63

Open
jamminjames opened this issue Jul 12, 2018 · 13 comments
Open

How do you install this module? #63

jamminjames opened this issue Jul 12, 2018 · 13 comments

Comments

@jamminjames
Copy link

I don't see any explanation of how to install this on a server and get it to work with a nginx installation...

@wilmardo
Copy link

You need to compile it with nginx with the --add-module flag.
See this link for an example

@meugamer
Copy link

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.

@dvershinin
Copy link

dvershinin commented May 12, 2019

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;

@emmm-dee
Copy link

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.

@dvershinin
Copy link

@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:

  1. fetch source of nginx version that matches to your current production one
  2. ./configure --add-dynamic-module=/path/to/ngx_cache_purge --with-compat
  3. 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.

@emmm-dee
Copy link

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.

@dvershinin
Copy link

dvershinin commented Aug 14, 2019

@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 .

@emmm-dee
Copy link

@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

@dvershinin
Copy link

@emmm-dee as long as you did configure with --with-compat, it should be fine :)

You're welcome.

@jamminjames
Copy link
Author

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.

@dvershinin
Copy link

The point of subscription is easy updates and there’s far more than this module available.

Other ways:

  • Compile it yourself. Pollute production system with compilation software. Potentially having to disable Selinux. Recompile with every new nginx version.
  • Nginx plus and thousand dollars per year minimum
  • Quite a bunch of free repos you can find online. Often outdated and not compatible with nginx base. Often those are all-in-one bloatware nginx binaries with unneeded modules

Getpagespeed repo is free for CentOS/RHEL 8 as of this writing so is also an option.

@jamminjames
Copy link
Author

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.

@dvershinin
Copy link

Things are still quite in flux with CentOS 8:

  • some packages missing rebuilds, primarily Varnish VMODs
  • CentOS 8 prefers "modular" packages over regular ones, and modular packages are not yet available.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants