preface

This article focuses on the installation of the Nginx Linux environment and Windows.

Nginx is introduced

Nginx(” Engine X “) is a high-performance Web and reverse proxy server developed by Igor Sysoev, a Russian programmer. It is also an IMAP/POP3/SMTP proxy server.

HTTP basic features:

  • Handle static files, indexed files, and automatic indexing;
  • Reverse proxy acceleration (no caching), simple load balancing and fault tolerance;
  • FastCGI, simple load balancing and fault tolerance;
  • Modular structure. Filters include Gzipping, Byte ranges, chunked Responses, and Ssi-filter. In SSI filters, multiple sub-requests to the same proxy or FastCGI are processed concurrently;
  • SSL and TLS SNI support;

IMAP/POP3 proxy service functions:

  • Redirect the user to the IMAP/POP3 back end using an external HTTP authentication server;
  • After authenticating users using an external HTTP authentication server, the connection is redirected to the internal SMTP back end.
  • Certification method:
  • POP3: POP3 USER/PASS, APOP, AUTH LOGIN PLAIN CRAM-MD5;
  • IMAP: IMAP LOGIN;
  • SMTP: AUTH LOGIN PLAIN CRAM-MD5;
  • SSL support;
  • STARTTLS and STLS support in IMAP and POP3 modes;

.

More theoretical knowledge is not introduced here, details can be viewed in the official document, address :nginx.org/en/

The forward proxy mainly makes requests for the client. A reverse proxy mainly receives requests for the server.

Nginx Linux installation

Nginx relies on pcRE, Openssl, and zlib to make nginx support Rewrite functionality.

  • PCRE download address: sourceforge.net/projects/pc…
  • Zlib download address: zlib.net/
  • Download Openssl at www.openssl.org/source
  • Download Nginx at nginx.org/download

PCRE installation

1. Document preparation

Upload the downloaded file to the /opt/nginx directory using FTP. If no, create a new file. The decompression command is used as follows:

The tar ZXVF pcre – 8.35. Tar. Gz

2, installation,

Then unzip the directory to compile and install, enter:

CD pcl-8.35./configure make make installCopy the code

After the installation is successful, view the version information and enter:

pcre-config --version
Copy the code

Zlib installation

Basically the same as above.

1. Document preparation

Upload the downloaded file to the /opt/nginx directory using FTP and decompress the file.

The tar ZXVF – zlib – 1.2.11. Tar. Gz

2, installation,

Then unzip the directory to compile and install, enter:

CD zlib-1.2.11./configure make make installCopy the code

Openssl installation

Basically the same as above.

1. Document preparation

Upload the downloaded file to the /opt/nginx directory using FTP and decompress the file.

The tar – ZXVF openssl – 1.0.2 q.t ar. Gz

2, installation,

Then unzip the directory to compile and install, enter:

CD openssl-1.0.2q./config make make installCopy the code

Nginx installation

This is basically the same thing.

1. Document preparation

Upload the downloaded file to the /opt/nginx directory using FTP and decompress the file.

The tar ZXVF nginx – 1.6.2. Tar. Gz

2, installation,

Then unzip the directory to compile and install, enter:

CD nginx-1.6.2./config make make installCopy the code

After the installation is successful, view the version information and enter:

/usr/local/nginx/sbin/nginx -v
Copy the code

Nginx: error while loading shared libraries: libpcre.so.1

The pcRE is not installed or the soft chain is not configured. Install or set the soft chain.

ln -s /usr/local/lib/libpcre.so.1 /lib64/

3, Nginx command

Nginx. conf is configured correctly.

/usr/local/nginx/sbin/nginx -t 
Copy the code

Start the nginx service according to the configuration in nginx.conf:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf  
Copy the code

Configuration file hot loading command:

/usr/local/nginx/sbin/nginx -s reload
Copy the code

Close command:

kill -QUIT `cat /usr/local/nginx/logs/nginx.pid` 
Copy the code

Or find nginx processes and kill them, including nginx daemons.

ps -ef | grep nginx
kill -9 pid
Copy the code

Restart command:

kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
Copy the code

Nginx can be accessed directly by typing the Linux IP address in the browser. The default port is 80.

Nginx Windows installation

Windows Nginx installation does not require the above dependencies, directly download and decompress the run.

Windows Nginx download: nginx.org/en/download…

Download interface:

After downloading Nginx, unzip it and double-click nginx.exe to run it or enter CMD start Nginx in the same directory.

You can stop nginx by entering nginx -s stop or nginx -s quit. The nginx saves the information. The nginx does not. The hot load command is still nginx -s reload.

Nginx can be accessed directly by typing localhost or 127.0.0.1 in your browser.

other

See the Nginx website at nginx.org/en/

Music to recommend

Original is not easy, if you feel good, hope to praise or recommend! Your support is the biggest motivation for my writing! Copyright: www.cnblogs.com/xuwujing CSDN blog.csdn.net/qazwsxpcm Nuggets: juejin.cn/user/365003… Personal blog: www.panchengming.com