Installing nginx + geoip with puppet - nginx

I'm currently using:
mod 'nginx', :git => 'https://github.com/puphpet/puppet-nginx.git'
with a customised puphpet file that loads nginx but the version we get installed does support
–with-http_geoip_module.
All of the posts on installing geoip functionality, suggest that the only way to get geoip support is to recompile nginx.
Search for compiling packages with puppet suggests it's not the best way forward. Is there anywhere I can get the pre-packaged nginx module that supports geoip?
I'm using ubuntu 12.04

You'll need to find a repo that has this module already added. If you find it, you can simply use that.
This one may be what you need: https://launchpad.net/~nicolas-zin/+archive/ubuntu/nginx

Puppet workflows that rely on compiling your own packages are actually commonplace. What's not a good idea is for Puppet to do the actual compiling.
Build and maintain your packages with whatever tool chain fits your needs best. Maintain a package repository, and use Puppet to configure your nodes to use your repo. Puppet can then install your custom packages just like any other.

Related

Install net-snmp on RHEL without yum (or any other package managing software)

Currently I'm working on installing the net-snmp package on bunch of RHEL servers (versions vary from 5.x ~ 6.x).
To be specific, I need net-snmp.x86_64 and net-snmp-utils.x86_64 to create /etc/snmp/snmpd.conf file.
In normal cases, I'd just use yum to simply install them but the servers I'm working on has a firewall blocking all connections except the ones specified in the firewall.
I'm also not allowed to configure the firewall to enable yum to download the packages online due to security reasons (not sure why, though).
So I downloaded the net-snmp-5.8.tar.gz file to my PC and SCP'd it to the servers and tried to manually install it there.
But since I'm no expert on this, I just couldn't get them installed with the information online.
The files seem to be running but it doesn't create the snmpd.conf file that I need, or any other SNMP configs.
Is there a guide to installing these packages properly using the tar.gz file? Or is there something wrong here?
Thanks in advance :)
Have you run the snmpconf script? If I remember correctly it should have been installed along with net-snmp and it will generate an snmpd.conf file that is at least a good starting point if not the final one you'll want.

How to upgrade nginx to latest on Amazon Linux AMI 2018.03?

I have an Elastic Beanstalk web application using Amazon Linux AMI that requires the latest build of nginx. The nginx build that comes with AMI version 2018.03 is version 1.12.1, whereas the latest stable build on nginx.org is 1.15.4. Only 1.12.1 is available from Amazon's yum repositories. The preferred strategy we would like to use would be to create a custom RPM and pull that from an endpoint and install. How would I go about creating a custom RPM of nginx that would run on Amazon Linux? Or is there a pre-built source that I could take advantage of?
It turns out the best way to do this is to create a custom AMI. You can find instructions on how to create a custom AMI here:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.customenv.html
And how to install from source here:
How to install nginx 1.9.15 on amazon linux disto
If you want to swap out a running instance try here:
https://www.photographerstechsupport.com/tutorials/upgrade-running-nginx-amazon-linux/
I personally got it working with a mix of the code from those two sources. I also had to yum install gcc to get make to work, and had to manually add the folder /var/cache/nginx before the nginx service would work. Happy upgrading!

Recompile Nginx with additional modules

I installed Nginx via apt-get on Debian a while ago, and I've got a couple of sites live on it. Now I need to install some additional modules, and as I don't want to mess anything up I'd like to double check my process before I perform it. Hopefully this will also help others that are unsure about this part.
As I've understood it I have to do the following to minimize the downtime:
Download the source for Nginx
Add the additional modules with ./configure --additional-module
Compile Nginx with make
Stop the current server (service nginx stop)
Install Nginx with make install
Start the new server (service nginx start)
Or do I have to uninstall Nginx first, as it's not compiled from source at this point?
Having done something similar on Ubuntu before, the installation should overwrite the existing nginx binaries with the newly compiled ones, so long as yes, you ensure nginx isn't running on the system at the time.
I'd recommend trying to install nginx elsewhere on the system, so in case you can't get it to work quickly, you can restart your web server with the old nginx binaries and not have significant downtime.
nginx -V - helpful command which shows options for .\configure which was used to make nginx, which is actually working.
Helpful to get detail imagination about.
apt-get source nginx - to get source
install will automatically substitute actual installed version by new one
Keep also in mind that some nginx-modules can require additional libs on server. geoip module is classical example of it

How to configure additional modules to nginx after installation?

I have installed Nginx in our redhat machine using rpm. Now we want to add nginx-rtmp module, but inorder to add new module as per the document i need to build it by downloading the tar ball. Does it mean that i have to remove the rpm and install it as per the document.
Ref: https://github.com/arut/nginx-rtmp-module/wiki/Getting-started-with-nginx-rtmp
./configure --add-module=/usr/build/nginx-rtmp-module
make
make install
With nginx 1.9.11, it's not necessary to recompile the server, as they added support for dynamic modules. Take a look here:
https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/
Unlike Apache, all modules, including the 3rd party modules, are going to be compiled into nginx. So every time you want to add a new module, you have to recompile nginx.
So yes, you have to install it as per the document. There is no much value of keeping 2 nginx runtimes on the same server any way. So you may also want to remove the previous nginx.
I had a similar problem where the auth-pam module broke after an upgrade. Here's what fixed it for me (debian stretch/sid, nginx 1.10.2):
apt install libnginx-mod-http-auth-pam
ln -s /usr/share/nginx/modules-available/mod-http-auth-pam.conf /etc/nginx/modules-enabled/50-mod-http-auth-pam.conf
The config file contains a single “load_module” directive which tells nginx to dynamically load the module on startup. As jekennedy mentioned, this would only apply to newer versions of nginx that support dynamic module loading.
Yes, you have to uninstall nginx (installed via rpm) and re-install it according to the mentioned document that is from source file. There are some disadvantages of installing nginx using source, like you cannot use nginx as a service. Here, you can find instructions to do same thing with all the functionalities you get while installing nginx using OS-respective packages.
Following the steps in this post from the nginx blog page called "Compilation of Dynamic Modules for NGINX Plus", i could compiled the RTMP módule, downloading the nginx-rtmp-module from Github and import it on my webserver.
Regards.

Install PHP Extensions Without Rebuild

I've got a VPS setup with Nginx & PHP5-FPM.
Being fairly new to unix, VPS etc... it took me ages to get the setup I wanted.
However Now I want to be able to install some extensions onto PHP without haveing to rebuild the entire thing. For example. Is there a way to install the php_tidy extension on an existing PHP setup?
You can compile an extensions as a shared library. Then you just have to declare your module in the php.ini.
There is a description at php.net for phpize.
Performance differences between a module and a full compilation are discussed here.
Check out the documentation at http://pecl.php.net/ on how to install PHP extensions.
It's usually as easy as running a command such as
pecl install tidy

Resources