Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Nginx HTTP Server

You're reading from   Nginx HTTP Server Harness the power of Nginx to make the most of your infrastructure and serve pages faster than ever before

Arrow left icon
Product type Paperback
Published in Feb 2018
Publisher Packt
ISBN-13 9781788623551
Length 348 pages
Edition 4th Edition
Languages
Tools
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Martin Bjerretoft Fjordvald Martin Bjerretoft Fjordvald
Author Profile Icon Martin Bjerretoft Fjordvald
Martin Bjerretoft Fjordvald
Mr. Clement Nedelcu Mr. Clement Nedelcu
Author Profile Icon Mr. Clement Nedelcu
Mr. Clement Nedelcu
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Downloading and Installing Nginx 2. Basic Nginx Configuration FREE CHAPTER 3. HTTP Configuration 4. Module Configuration 5. PHP and Python with Nginx 6. Nginx as an Application Server 7. Apache and Nginx Together 8. From Apache to Nginx 9. Introduction to Load Balancing and Optimization 10. Case Studies 11. Troubleshooting 12. Other Books You May Enjoy

Downloading Nginx

This approach to the download process will lead us to discover the various resources at the disposal of server administrators, websites, communities, and wikis all relating to Nginx. We will also quickly discuss the different version branches available to you, and eventually select the most appropriate one for your setup.

Websites and resources

Although Nginx is a relatively new and growing project, there are already a good number of resources available on the World Wide Web (WWW) and an active community of administrators and developers.

The official website, which is at http://nginx.org/, currently serves as an official documentation reference, and provides links from which to download the latest version of the application source code and binaries. A wiki is also available at https://www.nginx.com/resources/wiki/ and offers a wide selection of additional resources such as installation guides for various operating systems, tutorials related to the different modules of Nginx, and more.

There are several ways to get help if you should need it. If you have a specific question, try posting on the Nginx forum—https://forum.nginx.org/. An active community of users will answer your questions in no time. Additionally, the Nginx mailing list, which is relayed on the Nginx forum, will also prove to be an excellent resource for any question you may have. And if you need direct assistance, there is always a group of regulars helping each other out on the IRC channel #Nginx on irc.freenode.net.

Another interesting source of information is the blogosphere. A simple query on your favorite search engine should return a good number of blog articles documenting Nginx, its configuration, and modules:

Personal websites and blogs documenting Nginx

It's now time to head over to the official website and get started with downloading the source code for compiling and installing Nginx. Before you do so, let us have a quick summary of the available versions and the features that come with them.

Version branches

Igor Sysoev, a talented Russian developer and server administrator, initiated this open source project back in 2002. Between the first release in 2004 and the current version, the market share of Nginx has been growing steadily. It now serves nearly 15% of websites on the internet, according to a June 2015 https://www.netcraft.com/ survey. The features are numerous and render the application both powerful and flexible at the same time.

There are currently three version branches on the project:

  • Stable version: This version is usually recommended, as it is approved by both developers and users, but is usually a little behind the mainline version.
  • Mainline version: This is the latest version available for download and comes with the newest developments and bug fixes. It was formerly known as the development version. Although it is generally solid enough to be installed on production servers, there is a small chance that you will run into the occasional bug. As such, if you favor stability over novelty, going for the stable version is recommended.
  • Legacy version: If, for some reason, you are interested in looking at the older versions, you will find several of them.

A recurrent question regarding mainline versions is "Are they stable enough to be used on production servers?" Cliff Wells, the original founder and maintainer of the Nginx wiki https://www.nginx.com/resources/wiki/, believes so – "I generally use and recommend the latest development version. It's only bit me once!" Early adopters rarely report critical problems. It is up to you to select the version you will be using on your server, knowing that the instructions given in this book should be valid regardless of the release as the Nginx developers have decided to maintain overall backwards compatibility in new versions. You can find more information on version changes, new additions, and bug fixes in the dedicated change log page on the official website.

Features

As of the mainline version 1.13.8, Nginx offers an impressive variety of features, which, contrary to what the title of this book indicates, are not all related to serving HTTP content. Here is a list of the main features of the web branch, quoted from the official website http://nginx.org/:

  • Serving static and index files, auto indexing; open file descriptor cache; accelerated reverse proxying with caching; load balancing and fault tolerance.
  • Accelerated support with caching of FastCGI, uWSGI, SCGI, and memcached servers; load balancing and fault tolerance; modular architecture. Filters include gzipping, byte ranges, chunked responses, XSLT, SSI, and image transformation filter. Multiple SSI inclusions within a single page can be processed in parallel if they are handled by proxies or FastCGI/uWSGI/SCGI servers.
  • SSL and TLS SNI support.

Nginx can also be used as a mail proxy server, although this aspect is not closely documented in the book:

  • User redirection to IMAP/POP3 backend using an external HTTP authentication server
  • User authentication using an external HTTP authentication server and connection redirection to an internal SMTP backend
  • Authentication methods:
    • POP3: USER/PASS, APOP, AUTH LOGIN/PLAIN/CRAM-MD5
    • IMAP: LOGIN, AUTH LOGIN/PLAIN/CRAM-MD5
    • SMTP: AUTH LOGIN/PLAIN/CRAM-MD5
    • SSL support
    • STARTTLS and STLS support

Nginx is compatible with most computer architectures and operating systems—Windows, Linux, Mac OS, FreeBSD, and Solaris. The application runs fine on 32- and 64-bit architectures.

Downloading and extracting

Once you have made your choice as to which version you will be using, head over to http://nginx.org/ and find the URL of the file you wish to download. Position yourself in your home directory, which will contain the source code to be compiled, and download the file using wget:

[[email protected] ~]$ mkdir src && cd src
[[email protected] src]$ wget http://nginx.org/download/nginx-1.13.8.tar.gz  

We will be using version 1.13.8, the latest stable version as of February, 2018. Once downloaded, extract the archive contents in the current folder:

[[email protected] src]$ tar zxf nginx-1.13.8.tar.gz

You have successfully downloaded and extracted Nginx. Now, the next step will be to configure the compilation process in order to obtain a binary that perfectly fits your operating system.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image