Installing Nginx-auth-ldap on Debian - nginx

I tried to install Nginx-auth-ldap on my Debian server, but I can't understand how to do it right. I have been looking on https://github.com/kvspb/nginx-auth-ldap/wiki/How-to-install and tried the commands for Linux.
The thing I can't understand is
./configure --add-module=path_to_http_auth_ldap_module
make install
I don't have a folder called configure in the Nginx folder.
Please help me to understand how I will make that work.

The key is one sentence from the linked page that you skipped. The whole instructions say:
cd ~ && git clone https://github.com/kvspb/nginx-auth-ldap.git
in nginx source folder
./configure --add-module=path_to_http_auth_ldap_module
make install
"In nginx source folder" refers to a directory where you would have the source code of nginx. This means you are supposed to re-build nginx with the new module.
What you should do
Download the nginx sources 1
Download the nginx-auth-ldap module
Compile nginx with the module
However, I did not test this, so it is possible that you need additional libraries or sources like the ones for ldap...

Don't install nginx through Debian's package manager. Instead, as jasperado suggested, you'll want to download nginx from source.
You can download the mainline version thus:
wget http://nginx.org/download/nginx-1.9.2.tar.gz && tar xzf nginx-1.9.2.tar.gz
Before you build, you may want to make sure PCRE3 is installed on your system because ngx_http_rewrite_module requires it, and the installer will try to load this module.
When ready, you go into the nginx source directory and then you can do the whole configure and make thing. You might find this article helpful.
For example,
./configure --prefix=/usr/local --with-http_stub_status_module --add-module=$HOME/nginx-auth-ldap
make
sudo make install

Related

Does make/gmake include all the libraries after built?

I was building the openresty Nginx on machine A and want to use it on machine B. Is it necessary to install all the rpm/dependencies on machine B?
The building process on machine A is like:
yum install multiple-devel commands
git clone multiple repositories
wget openresty.tar.gz
untar openresty, cd openresty and ./configure --...
gmake
gmake install
When I tried to understand the relationships between configure, make and make install, I found https://stackoverflow.com/a/54628708/11887927 but still not quite get it.
If it's still required to install all the rpm&dependencies, what's the benefit of building on my own or I'm totally wrong about the make process?
Maybe I didn't make myself clear enough. Thanks for anyone stopping by.
Machine B doesn't require rpm/dependencies but needs libraries built on machine A
Here is how it works:
copy Nginx binary/configurations to B
copy libraries(including folders, openresty in my case) to B
echo libraries to /etc/ld.so.conf.d, /etc/ld.so.conf.d/luajit.conf in my case

How to install a module on nginx?

When running nginx -t I get this error:
nginx: [emerg] unknown directive "subs_filter_types" in /etc/nginx/sites-enabled/my.site.com.conf:285
nginx: configuration file /etc/nginx/nginx.conf test failed
So I need to install the substitution filter module and in the nginx documentation https://www.nginx.com/resources/wiki/modules/substitutions/#subs-filter-types
Which says to run these commands:
git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
./configure --add-module=/path/to/module
The problem is I don't have the configure script anywhere in my nginx installation nor in the
git repository. I really don't understand.
At the very least I want to know the content of that nginx configure script.
The instructions you are referring to are for compiled installation.
Assuming you want to add the module to your existing NGINX install, below are the generic steps that will get things running.
Fetch exactly matching version of NGINX as the one you have installed, from nginx.org onto your system and extract it to, say, /usr/local/src/nginx
git clone NGINX module's source code onto your system, to e.g. /usr/local/src/nginx-module-foo
cd /usr/local/src/nginx. This is where you will find the configure script. You will basically configure NGINX with the location of the config of specific module in question, thus next step:
./configure --add-dynamic-module=../nginx-module-foo --with-compat
make
As a resulf of the compilation you will have module's .so file somewhere in objs directory of your NGINX sources. You will then copy it over to e.g. /usr/lib64/nginx/modules/ directory.
To make your existing NGINX load the module, add load_module modules/foo.so; at the very top of /etc/nginx/nginx.conf.
You can decipher the many downsides to the whole compiled approach: one is having compilation software (gcc) on a production system, other is having to re-do all those steps any time you upgrade NGINX or the module.
For the reasons mentioned, you might want to search for a packaged install of third-party modules.
For CentOS/RHEL systems, you might want to look at GetPageSpeed repos (subscription-ware, and I'm biased to mention it, because I'm the maintainer. But this is free for CentOS/RHEL 8 at the time of this writing. Installing the module you want, goes down to a couple of commands:
yum -y install https://extras.getpagespeed.com/release-latest.rpm
yum -y install nginx-module-substitutions
For Debian-based systems, probably there are alternative PPAs existing for the same.
Just replace prefix subs with sub.
For default nginx 1.10.3 installation (Ubuntu 16.04.5 LTS)
nginx -V should have flag --with-http_sub_module to use sub_* directives.
Usage example:
sub_filter_types text/html text/css text/xml;
sub_filter 'needle' 'replacement';
sub_filter_once off;
NGINX documentation link

Where to install "guile-git" on Ubuntu 14?

I got stuck installing "git clone https://gitlab.com/guile-git/guile-git.git". In which directory is this supposed to be cloned and installed?
Dunno if you're still looking for an answer but it doesn't seem you need this installed to install guix; the read-me of the repository says that you can install it via guix. guix is an agnostic package manager that you can install on any Linux distribution alongside the default package manager and guix is the default package manager of the GuixSD operating system (https://www.gnu.org/software/guix/).
If you're on a distro which doesn't use guix, you may not want to install guix (I've yet to find reason enough to, yet); if you use a lot of GNU tools or Guile (some Guile packages are available through guix), you may want to.
Most repositories that don't have a binary for you to run follow the build process of configure, make, and [sudo ]make install.
I cloned the repository, myself, and find that this one does, as well.
Get a terminal (if you haven't been using one, yet) and cd into the directory you cloned the repository to and then cd into the guile-git directory (cd guile-git).
If we do ls -l, we'll see that the only executable file there is the bootstrap one; I've never seen one before but doing ./bootstrap generates the configure file and sets up the make process for us. So now back in familiar territory.
Given these are Guile files, we'll probably want to install this under the same prefix as where Guile is installed so run which guile. I believe, if you install it under Ubuntu (I'm running Linux Mint), it'll install to /usr/bin/ but, if you install it manually, it'll install to /usr/local/bin/.
The latter is where mine is and that's the default prefix that configure uses so I can just do ./configure; if you wanted to install it under /usr/, run /.configure --prefix=/usr/.
This'll verify that all of the necessary libraries and programs that guile-git needs are installed and properly setup. Heads up that configure balked at me over not having the Guile module bytestructures installed (https://github.com/TaylanUB/scheme-bytestructures) so you may need to do that.
I'm not going to run through everything to get it installed but, once you can run it without any errors, run make to build it within the directory.
If you want to install it permanently on your computer with the rest of your operating system able to detect it, run make install. Since you'll likely've specified a directory under /usr, you'll have to do sudo make install so that the make process can have permissions to install under /usr/local or /usr.
Sorry if I reiterated anything you already knew; 'just didn't want to assume you knew something and result in confusion.

Centos6 PHP7 Install SPL_Types

I am running CentOS 6 and am trying to install the SPL_Types extension for PHP7. I have php7 up and running however, any time I do pecl install SPL_Types,
I get massive compiler errors and can't find a way around. Ubuntu users can fix the issue by installing libpcre3-dev, but this is not a valid package on CentOS 6. I have verified that pcre and pcre-devel are installed and the latest version. Does anyone have a solution to this?
EDIT 1: A full log when I run the sudo pecl install SPL_Types command: http://pastebin.com/QG3mFjaf
I got it figured out. For those who wish to know, I had to use a third party source to compile and install the extension, then I had to edit my php.ini file manually to add the new module.
https://github.com/esminis/php_pecl_spl_types
then once you have it, run the commands:
phpize --clean
phpize
chmod +x configure
./configure --prefix=/usr
make install
Then, edit your php.ini file and under the dynamic modules section, add
extension=spl_types.so
Restart the httpd service by doing
sudo service httpd restart
Then verify the new module is loaded with phpinfo().

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

Resources