Nginx (two): Nginx basic installation

Windows-based installation

 

 

 

Linux-based installation

Preparing the Environment

  • CentOS7  
  • Nginx1.9
  • gcc gcc-c++
  • PCRE library
  • OpenSSL library
  • zlib library

Basic Installation

1. Install gcc gcc-c ++

Install nginx need to first download the official source code to compile, gcc compiler-dependent environment

$ Yum  install - and gcc  gcc - c ++

2. Install wget (if not installed, install)

$ yum -y install wget

3. Install PCRE library

PCRE (Perl Compatible Regular Expressions) is a Perl library, including perl-compatible regular expression library. The module uses nginx http pcre regular expressions to parse, so it is necessary to install pcre library on linux, pcre-devel pcre developed using a secondary development library.

$ cd /usr/local/
$ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
$ tar -zxvf pcre-8.33.tar.gz
$ cd pcre-8.33
$ ./configure
$ make && make install

4. Install OpenSSL library

OpenSSL is a powerful Secure Sockets Layer cryptographic library cryptographic algorithms include major, commonly used key and certificate management and SSL protocol encapsulation, and provides a wealth of applications for testing or other purposes. nginx not only supports the http protocol, also supports https (http over ssl ie transmission protocol)

$ cd /usr/local/
$ wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz
$ tar -zxvf openssl-1.0.1j.tar.gz
$ cd openssl-1.0.1j
$ ./config
$ make && make install

5. Install zlib library

zlib library provides a variety of compression and decompression of the way, nginx http content using zlib to perform gzip package

$ cd /usr/local/
$ wget http://zlib.net/zlib-1.2.11.tar.gz
$ tar -zxvf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure
$ make && make install

6. Install nginx

$ cd /usr/local/
$ wget http://nginx.org/download/nginx-1.9.0.tar.gz
$ tar -zxvf nginx-1.9.0.tar.gz
$ cd nginx-1.9.0 
$ ./configure
$ make && make install

7. detects whether the installation is successful

$ cd  /usr/local/nginx/sbin
$ ./nginx -t

Nginx commonly used commands

1. Display help information

$ /usr/local/nginx/sbin/nginx -h

Help information is as follows:

Options:
   -, -? H: Help the this   (display help information)
   - v: Show Version and Exit   (print nginx version, compile information, etc.)
   -V: Options Show Version and the configure the then Exit   (print nginx version, compile information, etc.)
   - t: the Test the configuration and Exit   (to detect syntax)
   -q: the suppress value NON- error messages During the configuration Testing 
# send signal (immediately stop stop, stop elegance quit, reload the configuration file reload, restart the diary Reopen)
- S signal: A Process to Master Signal Send: STOP, quit, Reopen, reload -p prefix: SET prefix path (default: / usr / local / Nginx / ) (designated running directory) -C filename: SET Configurationfile (default: conf/nginx.conf) -g directives : set global directives out of configuration file

2. Start nginx

$ /usr/local/nginx/sbin/nginx

3. Review process

$ Ps -aux | grep  ' nginx '

 4. Stop Nginx

$ / Usr / local / nginx / sbin / nginx - S quit     # elegant way to send a signal to stop quit 
or $
 / usr / local / nginx / sbin / nginx -s stop     # way to send a signal to immediately stop stop

5.Nginx reload configuration

$ / Usr / local / nginx / sbin / nginx -s reload   # way to send a signal to immediately stop stop

 

 

Guess you like

Origin www.cnblogs.com/kongliuyi/p/11494746.html