As you may know the latest versions of the software packages are not available in the software repositories. It can take few months for any release upgrade to appear in the repository. Unfortunately in the real world the latest releases never appear in the official repositories of RHEL/CentOS Linux.
In my opinion it is extremely risky to install the packages that were pre-configured by someone else because such packages can contain back-doors or malware.
However you can always keep your NginX up to date using the package with the source code. There is nothing to be afraid of with such approach.
The following article describes how to compile the latest NginX using the source package.
I used fresh installation of the CentOS 6.7 to test this tutorial.
First of all make sure that your system has required packages:
I'd recommend to include
srcache module into installation.
The complete list of the releases can be found on the following page:
Let's use the default manual and include the module into NginX on the compilation stage with
tar xf v0.30.tar.gz
The final preparation step is to create system user for
useradd -d /opt/nginx -s /bin/false nginx
Download and uncompress the source package:
tar xf nginx-1.11.6.tar.gz
Configure and make it. I am using the
/opt/nginx as an installation prefix. Without this it will be installed into
/usr/local/nginx. You can specify alternative location:
If you used another tutorial and installed the latest OpenSSL according to it than you can compile NginX with support of the latest OpenSSL. Please add the following to configure arguments:
make ends with an error related to the OpenSSL, than there might be a need to fix the source file. Run the following in the NginX source folder:
After this the NginX will be installed into the /opt/nginx folder.
Next step would be to create the init.d script that will be used to start, stop and restart the daemon. The contents of the working script can be found on one of the following pages:
You will need to edit the definitions of the following variables:
When the script is created, let's make it executable and enable autostart on boot:
chkconfig nginx on
In Ubuntu/Debian, you will need to use the following command to enable upstart for NginX:
Edit the configuration file
/opt/nginx/conf/nginx.conf with the definition of the user that to run the web server:
After this you can start the NginX by running the following:
Behind this point you can proceed with the configuration according to the official documentation.
The version can be verified in the responce headers: