Install and configure Nginx in Linux

Source: Internet
Author: User
Tags http authentication imap install openssl openssl library sendfile
Nginx is a high-performance, high-performance Web and reverse proxy server with many excellent features: Nginx is a good alternative to Apache server in the case of high connection concurrency: nginx is one of the software platforms that bosses often choose to do virtual host business in the United States. Supports up to 50,000

Nginx is a high-performance Web and reverse proxy server with many excellent features:
In the case of high connection concurrency, Nginx is a good alternative to Apache servers: Nginx is one of the software platforms that are frequently chosen by the owners of virtual host businesses in the United States. It can support responses of up to 50,000 concurrent connections. thanks to Nginx for choosing epoll and kqueue as the development model ..

 

As a server load balancer server, Nginx can support both the external services of Rails and PHP programs and the external services as an HTTP proxy server. Nginx is written in C, which is much more efficient than Perlbal in terms of system resource overhead and CPU usage.

As a mail proxy server: Nginx is also a very good mail proxy server (one of the earliest development purposes of this product is also as a mail proxy server), Last. fm describes the success and wonderful use experience.

Nginx is a simple installation, and the configuration file is very simple (it also supports perl syntax). servers with few Bugs: Nginx is particularly easy to start, in addition, it can run almost without interruption and does not need to be restarted even if it is running for several months. You can upgrade the software without interruption.


[Nginx overview]

Basic HTTP functions:
Process static files, index files, and automatic indexing;
Reverse proxy acceleration (no cache), simple load balancing and fault tolerance;
FastCGI, simple load balancing and fault tolerance;
Modular structure. Filters include gzipping, byte ranges, chunked responses, www.linuxidc.com, and SSI-filter. In the SSI filter, multiple sub-requests of the same proxy or FastCGI are concurrently processed;
SSL and tls sni support;

IMAP/POP3 proxy service features:
Use an external HTTP authentication server to redirect users to the IMAP/POP3 backend;
Use the external HTTP authentication server to authenticate the user and then redirect to the internal SMTP backend;

Authentication method:
POP3: POP3 USER/PASS, APOP, auth login plain CRAM-MD5;
IMAP: imap login;
SMTP: auth login plain CRAM-MD5;
SSL support;
STARTTLS and STLS support in IMAP and POP3 modes;

Supported operating systems:
FreeBSD 3.x, 4.x, 5.x, 6.x i386; FreeBSD 5.x, 6.x amd64;
Linux 2.2, 2.4, 2.6 i386; Linux 2.6 amd64;
Solaris 8 i386; Solaris 9 i386 and sun4u; Solaris 10 i386;
MacOS X (10.4) PPC;

Structure and expansion:
One master process and multiple worker processes. The worker process is single-threaded and runs without special authorization;
Kqueue (FreeBSD 4.1 +), epoll (Linux 2.6 +), rt signals (Linux 2.2.19 +),/dev/poll (Solaris 7 11/99 +), select, and poll support;
Different functions supported by kqueue include EV_CLEAR, EV_DISABLE (temporary prohibition event), NOTE_LOWAT, EV_EOF, number of valid data, and error code;
Sendfile (FreeBSD 3.1 +), sendfile (Linux 2.2 +), sendfile64 (Linux 2.4.21 +), and sendfilev (Solaris 8 7/01 +;
Supported input filtering (FreeBSD 4.1 +) and TCP_DEFER_ACCEPT (Linux 2.4 +;
10,000 inactive HTTP keep-alive connections only require 2.5 MB of memory.
Minimal data copy operations;
Other HTTP functions:
Virtual host service based on IP address and name;
GET interface of Memcached;
Supports keep-alive and MPs queue connections;
Flexible and simple configuration;
Reconfiguration and online upgrade without interrupting the customer's working process;
Customizable access logs, log writing to the cache, and quick log retrieval;
4xx-5xx error code redirection;
PCRE-based rewrite module;
Access control based on client IP address and basic HTTP authentication;
PUT, DELETE, and MKCOL methods;
Supports FLV (Flash video );
Bandwidth limit;

Lab features:
Embedded perl
The experiment module that works through the socket of aio_read ()/aio_write () is only under FreeBSD.
Experimental support for threads. the implementation of FreeBSD 4.x is based on rfork ()
Nginx main English site is http://sysoev.ru/en/
The English document draft is completed by Aleksandar Lazic.


Three supported versions are required before installation: gzip, pcre, and openssl.
[Install Nginx]

Module dependency
The gzip module requires the zlib library
The rewrite module requires the pcre library
Openssl library is required for ssl functions
Precompiled installation package

1 gzip support, need zlib http://www.zlib.net/download the latest version can be
2 rewrite module requires pcre library http://www.pcre.org/download the latest version
3 ssl functions need openssl library http://www.openssl.org/=> http://www.openssl.org/source/ LASTEST version can be
I encountered two problems during installation:

1./configure: error: the HTTP cache module requires md5 functions
From OpenSSL library. You can either disable the module by using
-- Without-http-cache option, or install the OpenSSL library into the system,
Or build the OpenSSL library statically from the source with nginx by using
-- With-http_ssl_module -- with-openssl = Options.

2./configure: error: the HTTP rewrite module requires the PCRE library.

The first problem is to install openSSl, and the second is to install pcre.
Installation process:
1. install and compile openssl
Tar zxvf openssl.tar.gz
Cd openssl
./Confbigure
Make
Make install

2. install and compile gzip
Tar zxvf gzip.tar.gz
Cd gzip
./Confbigure
Make
Make install

3. install and compile pcre
Tar zxvf pcre.tar.gz
Cd pcre
./Confbigure
Make
Make install

4. install nginx
Tar zxvf nginx.tar.gz
Cd nginx
./Configure -- with-pcre = ../pcre -- with-zlib = ../zlib -- with-http_ssl_module -- with-openssl = ../openssl
Make
Make install
Success...

Nginx currently does not support php directly. you must first use fastcgi to drive php. There are two good methods for fastcgi: spawn-fcgi and php-fpm. generally, php-fpm may be larger.
 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.