programming4us
programming4us
ENTERPRISE

Nginx HTTP Server : Setting up the prerequisites

10/8/2012 7:23:43 PM
We have chosen to download the source code of the application and compile it manually, as opposed to installing it using a package manager such as Yum, Aptitude, or Yast. There are two reasons behind this choice first, the package may not be available in the enabled repositories of your Linux distribution. On top of that, the rare repositories that offer to download and install Nginx automatically mostly contain outdated versions. More importantly, there is the fact that we need to configure a variety of significant compile time options. As a result of this choice, your system will require some tools and libraries for the compilation process.

Depending on the optional modules that you select at compile time, you will perhaps need different prerequisites. We will guide you through the process of installing the most common one such as GCC, PCRE, zlib, and OpenSSL.

GCC-GNU Compiler Collection

Nginx is a program written in C, so you will first need to install a compiler tool such as the GNU Compiler Collection (GCC) on your system. GCC usually comes with most distributions, but if, for some reason, you do not already have it, this step will be required.

GCC is a collection of free open source compilers for various languages C, C++, Java, Ada, FORTRAN, and so on. It is the most commonly-used compiler suite in Linux world, and Windows versions are also available. A vast amount of processors are supported such as x86, AMD64, PowerPC, ARM, MIPS, and more.


First, make sure it isn't already installed on your system:

[alex@example.com ~]$ gcc

If you get the following output, GCC is correctly installed on your system and you can skip to the next section:

gcc: no input files

If you receive the following message, you will have to proceed with the installation of the compiler:

~bash: gcc: command not found


GCC can be installed using the default repositories of your package manager. Depending on your distribution, the package manager will vary yum for Red Hat-based distribution, apt for Debian and Ubuntu, yast for SuSE Linux, and so on. Here is the typical way to proceed with the download and installation of the GCC package:

[root@example.com ~]# yum install gcc

If you use apt-get:

[root@example.com ~]# apt-get install gcc

If you use another package manager with a different syntax, you will probably find the documentation with the man utility. Either way, your package manager should be able to download and install GCC correctly, after having solved the dependencies automatically.

PCRE library

The Perl Compatible Regular Expression (PCRE) library is required for compiling Nginx. The Rewrite and HTTP Core modules of Nginx use PCRE for the syntax of their regular expressions. You will need to install two packages pcre and pcre-devel. The first one provides the compiled version of the library, whereas the second one provides development headers and source for compiling projects, which are required in our case.

Here are example commands that you can run in order to install both the packages.

Using yum:

[root@example.com ~]# yum install pcre pcre-devel

Or install all PCRE-related packages:

[root@example.com ~]# yum install pcre*

If you use apt-get:

[root@example.com ~]# apt-get install libpcre3 libpcre3-dev

If these packages are already installed on your system, you will receive a message saying something like Nothing to do, in other words, the package manager did not install or update any component.

zlib library

The zlib library provides developers with compression algorithms. It is required for the use of gzip compression in various modules of Nginx. Again, you can use your package manager to install this component as it is part of the default repositories. Similar to PCRE, you will need both the library and its source zlib and zlib-devel.

Using yum:

[root@example.com ~]# yum install zlib zlib-devel

Using apt-get:

[root@example.com ~]# apt-get install zlib1g zlib1g-dev

These packages install quickly and have no known dependency issues.

OpenSSL

The OpenSSL project is a collaborative effort to develop a robust, commercial-grade, full-featured, and open source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library. The project is managed by a worldwide community of volunteers that use the Internet to communicate, plan, and develop the OpenSSL toolkit and its related documentation http://www.openssl.org

The OpenSSL library will be used by Nginx to serve secure web pages. We thus need to install the library and its development package. The process remains the same here you install openssl and openssl-devel:

[root@example.com ~]# yum install openssl openssl-devel
    

Using apt-get:

[root@example.com ~]# apt-get install openssl openssl-dev

Please be aware of the laws and regulations in your own country. Some countries do not allow usage of strong cryptography. The author, publisher, and developers of the OpenSSL and Nginx projects will not be held liable for any violations or law infringements on your part.


Now that you have installed all the prerequisites, you are ready to download and compile the Nginx source code.

Other  
  •  The HP Virtual Server Environment : Secure Resource Partitions (Partitioning Inside a Single Copy of HP-UX)
  •  The HP Virtual Server Environment : HP Integrity Virtual Machines (Fully Virtualized Partitioning)
  •  Memory Management : Prevent Memory from Being Moved, Allocate Unmanaged Memory
  •  Memory Management : Use Pointers, Speed Up Array Access
  •  Memory Management : Force a Garbage Collection, Create a Cache That Still Allows Garbage Collection
  •  D-Link Cloud Router 5700 With 1750Mbps Total Band
  •  The HP Virtual Server Environment : Virtual Partitions (Peak Performance Virtualization)
  •  The HP Virtual Server Environment : nPartitions (Electrically Isolated Hardware Partitions)
  •  The HP Virtual Server Environment : The Partitioning Continuum at a Glance
  •  IBM WebSphere Process Server 7 and Enterprise Service Bus 7 : Monitoring WPS/WESB applications
  •  
    Video
    PS4 game trailer XBox One game trailer
    WiiU game trailer 3ds game trailer
    Top 10 Video Game
    -   Call Of Duty: Black Ops III [PS4/XOne/PC] Zombies - Shadows of Evil Trailer
    -   No Time To Explain [XOne/PC] Multiplayer Trailer
    -   Bierzerkers [PC] Early Access Trailer
    -   Downward [PC] Kickstarter Trailer
    -   Grip [PS4/PC] Trailer
    -   Hitman [PS4/XOne/PC] Debut Trailer
    -   Gears of War: Ultimate Edition [XOne] Recreating the Cinematics Trailer
    -   Gravity Falls: Legend of the Gnome Gemulets [3DS] Debut Trailer
    -   Street Fighter V [PS4/PC] Ken Trailer
    -   Doctor Who | Series 9 Teaser Trailer
    -   Transformers: Devastation | Gameplay Trailer (SDCC 2015)
    -   Tom Clancy's Rainbow Six Siege | Inside Rainbow #3 – The GIGN Unit
    -   Final Fantasy XIV: A Realm Reborn 'Alexander' Video
    -   SirVival Trailer
    -   Blood Bowl II [PS4/XOne/PC] Overview Trailer
    Game of War | Kate Upton Commercial
    programming4us
     
     
    programming4us