Linux Nginx installation and configuration instructions

Source: Internet
Author: User

Linux Nginx installation and configuration instructions

Nginx is a high-performance HTTP and reverse proxy server and an IMAP/POP3/SMTP proxy server. Nginx was developed by the Rambler.ru site with the highest access volume in Russia as Igor Sysoev. It has been running on this site for more than two and a half years. Igor releases the source code in the form of a class BSD license

1. To make sure that you can use Regular Expressions for more flexible configuration in Nginx, You need to determine whether the PCRE (Perl Compatible Regular Expressions) package is installed in the system before installation. Go to ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/to download the latest PCRE source code package. Run the following command to download and compile the PCRE package.

I have downloaded all the software to/software/nginx.

Nginx installation depends on gcc, openssl-devel, pcre-devel, and zlib-devel.

1. Install openssl first

Yum install openssl

2. Download the Rewrite configuration of pcre Software

Cd/software/nginx

Http://jaist.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.zip

Unzip pcre-8.32.zip
Cd pcre-8.32

./Configure

Make

Make install

3. Install zlib

Cd/software/nginx

Wget http://zlib.net/zlib-1.2.7.tar.gz
Tar-zxvf zlib-1.2.7.tar.gz
Cd zlib-1.2.7
./Configure
Make
Make install

4. Download Nginx Software

Http://nginx.org

Configuration and installation

./Configure-prefix =/usr/local/nginx-with-pcre =/software/nginx/pcre-8.32-with-http_ssl_module-with-http_stub_status_module-with-http_sub_module

Make

Make install

Note:-with-pcre =/software/nginx/pcre-8.32 refers to the pcre-8.32 source code path

 
Add:
Rewrite_log on;
Error_log logs/rewrite. error. log notice; # Check whether rewrite is correct.

5. Start Nginx

/Usr/local/nginx/sbin/nginx-t # test whether the configuration file is correct

The following statements are true:

/Usr/local/nginx/sbin/nginx # Start Nginx

If the following error occurs:

/Usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre. so.1: cannot open shared object file: No such file or directory

The solution is as follows:

On the RedHat 64-bit machine, nginx may read the/lib64/libpcre. so.1 file.

Ln-s/lib64/libpcre. so.0.0.1/lib64/libpcre. so.1

Ln-s/lib/libpcre. so.0.0.1/lib/libpcre. so.1

For more Nginx tutorials, see the following:

Deployment of Nginx + MySQL + PHP in CentOS 6.2

Build a WEB server using Nginx

Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5

Performance Tuning for Nginx in CentOS 6.3

Configure Nginx to load the ngx_pagespeed module in CentOS 6.3

Install and configure Nginx + Pcre + php-fpm in CentOS 6.4

Nginx installation and configuration instructions

Nginx log filtering using ngx_log_if does not record specific logs

Nginx details: click here
Nginx: click here

This article permanently updates the link address:

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.