Install Nginx 1.13.6 on CentOS 7.2

Source: Internet
Author: User
Tags install openssl openssl library nginx server

Install Nginx 1.13.6 on CentOS 7.2

This article describes how to install Nginx in Linux. the Linux system is CentOS 7.2.

1. Download Nginx from the official Nginx website. The version used here is 1.13.6.

2. Upload the downloaded Nginx to Linux. The/opt/nginx directory is used as an example. Run tar-zxvf nginx-1.13.6.tar.gz to decompress the package.

3. Switch to the/opt/nginx/nginx-1.13.6 directory and run./configure for Initialization Configuration. If the following prompt is displayed, it means that PCRE is not installed on the machine, and Nginx needs to depend on PCRE. You need to install PCRE manually, as shown in.

Install pcre:

PCRE (Perl Compatible Regular Expressions) is a lightweight Perl function library, including a perl-Compatible Regular Expression Library. It is much smaller than the regular expression library such as Boost. PCRE is very easy to use and has powerful functions. Its performance exceeds the POSIX Regular Expression Library and some classic Regular Expression Libraries.

1. First go to this to download pcre, where the download version is 8.40.

2. Upload pcre-8.40.tar.gz to the/opt/pcre directory, run tar-zxvf pcre-8.40.tar.gz, decompress the pcre-8.40 directory, and then run the chmod-R 777 pcre-8.40 to grant all read and write permissions to the current folder.

3. Go to the/pcre-8.40 directory, run./configure for Initialization Configuration, print a bunch of information, if the following prompt appears, because the C ++ compiler is missing.

Solution: run the yum-y install gcc-c ++ command to install the C ++ compiler.

After the C ++ compiler is installed successfully, run./configure.

4. Execute the make operation to compile.

5. Execute the make install command. Now the pcre installation is complete.

Continue back to the/opt/nginx/nginx-1.13.6 directory and run. /configure to initialize the nginx configuration, and print the following information to prove the success. The red arrow points to the address that is the path when nginx is started.

(Note: When you run./configure for nginx Initialization Configuration, you can use the following command to add an ssl module:

./Configure -- prefix =/usr/local/nginx -- with-http_ssl_module

If openssl is not installed before executing the preceding command, the following message is displayed:

./Configure: error: SSL modules require the OpenSSL library.

In this case, run yum-y install openssl-devel. After openssl is installed, the above operations can be performed smoothly)

4. Run make install to install

5. Run./nginx in the/usr/local/nginx/sbin directory to start nginx.

6. test whether the installation and startup are successful. Enter the Server IP Address: Port (80 by default) in the browser. If shown, the installation and startup are successful.

Common nginx commands:

View nginx processes: ps-ef | grep nginx

Start nginx and run:./nginx in the/usr/local/nginx/sbin directory.

Disable nginx: In the/usr/local/nginx/sbin directory, run:./nginx-s quit.

The nginx configuration file is in/usr/local/nginx/conf/nginx. conf, when the configuration file nginx. after the conf is modified, restart nginx to make the configuration take effect. /nginx-s reload can make the modified configuration take effect, so you do not need to stop and start it again.

You may also like the following Nginx articles. For more information, see:

Nginx 403 forbidden Solution

Install and configure the Nginx server in CentOS 7

Install the Nginx server on CentOS to redirect virtual hosts and domain names

Install the LNMP environment in CentOS 6.8 (Linux + Nginx + MySQL + PHP)

Install the PHP environment in Linux and configure Nginx to support the php-fpm Module

SSL authentication and htpasswd authentication for Nginx services

Enable encrypted and secure Nginx Web server on Ubuntu 16.04

Install and configure Nginx in Linux

Nginx log filtering using ngx_log_if does not record specific logs

Install and configure Nginx + PHP + MySQL + Memcache cache servers in CentOS 7.2

CentOS6.9 compile and install Nginx1.4.7

Nginx details: click here
Nginx: click here

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: 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.