Linux \ CentOS install nginx


The role of nginx:

  • Load balancing server
  • Mail proxy server
  • Realize dynamic and static separation of front end

Nginx features:

  • High stability
  • High performance
  • Less resources
  • Rich in function
  • Modular structure
  • Support hot deployment

Installation environment

  • System: CentOS 6.8 64 bit

Installation dependent

If you have never configured nginx before, you feel that the following entry commands are troublesome. You can directly enter them again and again.

  • All commands:
 yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

Here are the detailed instructions

1. Install GCC

  • Installation command
 sudo yum install gcc
  • Note: you can first enter gcc-v to query the version information to see if the system comes with it (if the version is too low, you can choose to update it or uninstall and then install it).

2. Installing PCRE

  • Installation command:
 sudo yum install pcre-devel

3. Install zlib

  • Installation command:
 sudo yum install zlib zlib-devel

4. Install OpenSSL

  • Installation command:
 sudo yum install openssl openssl-devel
  • Note: install OpenSSL only if SSL is required

5. Of course, it’s very troublesome to input the above commands. You can do it again and again.

  • All commands:
 yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

Download the nginx source package

It’s better to install the stable version by unzipping it (

(1) WGet… Or visit… To download.

(2) tar -zxvf nginx-1.14.2.tar.gz

Note that you can also specify the installation directory here, and add the parameter — prefix = / user / local / nginx. The complete command is as follows

 tar -zxvf nginx-1.14.2.tar.gz --prefix=/user/local/nginx
  • If you do not specify the default path, you can also query the installation path through where is nginx
  • The default installation path is under the / user / local / nginx directory

Install Nginx

(1) Enter the extracted nginx-1.14.2 directory and execute. / configure

(2) Continue with make to compile the link,

(3) Continue with the make install command for the installation steps.

After completing the above instructions, nginx has been installed.

Recommended Today

Configure Apache to support PHP in the Apache main configuration file httpd.conf Include custom profile in

In Apache’s main configuration file / conf/ http.conf Add at the bottom Include “D:workspace_phpapache-php.conf” The file path can be any In D: workspace_ Create under PHP file apache- php.conf file Its specific content is [html] view plain copy PHP-Module setup LoadFile “D:/xampp/php/php5ts.dll” LoadModule php5_module “D:/xampp/php/php5apache2_2.dll” <FilesMatch “.php$”> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch “.phps$”> SetHandler application/x-httpd-php-source </FilesMatch> […]