Installing Nginx under Linux

Source: Internet
Author: User
Tags openssl openssl library

Prior to using Nginx on Windows system, today try to install Nginx under Linux (CentOS7.2) success. Record it.

Nginx's Download

Nginx Bag: http://nginx.org/download/nginx-1.8.0.tar.gz

Nginx Dependency Package (to download the corresponding website):

1.gzip module requires zlib library (download http://zlib.net/zlib-1.2.8.tar.gz in http://www.zlib.net/)

2.rewrite module requires pcre library (download ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/in http://www.pcre.org/)

3.ssl function requires OpenSSL library (download http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz in http://www.openssl.org/)

Prerequisites for Installation:

Need to install the Gcc:yum install gcc-c++

First install the necessary library (Nginx in the gzip module need zlib library, rewrite module needs pcre library, SSL function requires OpenSSL library). Select /usr/local as the installation directory, copy the four jar packages to /usr/localin advance, and the following specific version numbers are changed according to the actual changes.

1. Installing the Pcre Library

$ cd /usr/local/$ tar -zxvf pcre-8.36.tar.gz$ cd pcre-8.36$ ./configure$ make$ make install

2. Installing the Zlib Library

$ cd /usr/local/ $ tar -zxvf zlib-1.2.8.tar.gz$ cd zlib-1.2.8$ ./configure$ make$ make install

3. Install SSL

$ cd /usr/local/$ tar -zxvf openssl-1.0.1j.tar.gz$ ./config$ make$ make install

4. Installing Nginx

$ cd /usr/local/$ tar -zxvf nginx-1.8.0.tar.gz$ cd nginx-1.8.0  --with-pcre= /usr/local /pcre-8.37  --with-zlib=/zlib-1.2.8-- /usr/local   With-openssl=/usr/local/openssl-fips-2.0.9  --

$ make install

5. Start

$ /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf

will appear:

Check whether the startup was successful:

Open the browser to access the IP of this machine if the browser appears Welcome to nginx! Indicates that Nginx is installed and running successfully.

Some commands are as follows:

Restart:
$/usr/local/nginx/sbin/nginx–s Reload

Stop it:
$/usr/local/nginx/sbin/nginx–s Stop

Test the configuration file for normal:
$/usr/local/nginx/sbin/nginx–t

Forced shutdown:
$ pkill Nginx

Installing Nginx under Linux

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.