Nginx instructions 01


brief introduction

The following is Baidu’s introduction:
Nginx(engine x) is a high-performanceHTTPandReverse proxyThe web server also provides IMAP / POP3 / SMTP services. Nginx was created by Igor, the second most visited site (Russian: Рамблер) The first public version 0.1.0 was released on October 4, 2004

Nginx can be used as a reverse proxy server / load balancing server / e-mail server, etc. nginx is applied in major websites. It is open source and free of charge

1. It occupies less memory and is developed in C language when the service is started
2. Strong concurrency. The concurrency of Tomcat server is 150-220 / s nginx 30000-50000 / s

We study this way mainly to use nginx as the reverse proxy server, so we need to understand what reverse proxy is!

Reverse proxy

Nginx instructions 01

To sum up:

  1. The forward proxy is the client proxy. The user clearly knows who the server is accessing. It protects the client information
  2. Reverse proxy is a server-side proxy. Users do not know who the real service is. It protects the server-side information

Installation and use of nginx


  1. Unzip nginx to the local disk directory
  2. Start nginx:
    Enter nginx console: execute CMD in the root directory of nginx.exe
    Common commands:

    Command 1: start nginx: start nginx
    Command 2: restart nginx: nginx - s reload
    Command 3: close nginx: nginx - s stop
  3. Nginx startup item description:
    Each time the nginx service is started, two process items (multiple threads) will be started
    Nginx daemon: it prevents the main process from shutting down unexpectedly. If it does, restart the main process
    Nginx main process: mainly provides reverse proxy service
  4. Description of nginx not starting normally
    DOS command: netstat – ANO
    Port 80 is occupied by PID = 4!! Problems such as system driver occupy port 80

matters needing attention

  1. Because the underlying implementation of nginx is written in C language, it is required that characters such as Chinese / space should not appear in the installation directory
  2. If the computer name is in Chinese, it needs to be changed to English
  3. When installing nginx, do not put it into the system file on drive C due to permission problems
  4. When nginx starts, it will occupy port 80