Nginx (for beginners)

Nginx

What is Nginx:

Nginx is a high-performance HTTP reverse proxy WEB server

Features of Nginx:

Design language: C language development

1: Low memory service occupies system memory no more than 3M

2: The official test of strong concurrent internal power is 50,000/

NGginx download and install:

Insert picture description here
Choose the appropriate version according to your own system!

I uploaded an old version of Windows from the network disk. If needed, I will pick it up:

Link: https://pan.baidu.com/s/1hpgJSONXBZ64fs3GHi7b-A
Extraction code: 7lab

Add another liunx version

Link: https://pan.baidu.com/s/1mYQPvEFJ2zZcaS7092CdtQ
Extraction code: c4pi

Do not have a Chinese path when installing

After decompression:


Click on the EXE file to run as an administrator

It will flash after opening, and then you can see whether the task manager service has started successfully!
Insert picture description here
Tip: You can jump to the Ngin service directly by clicking N when typing in English on the task manager detail page. If not, restart the service.

Nginx monitors port 80 by default , so you can enter in the browser: localhost for testing:

Insert picture description here
OK! The test is successful (unsuccessful or it may be that the port is occupied by yourself and check 80 who will use it again)

Next, you can do a simple configuration

Let me talk about Nginx service information first
Insert picture description here

Main service: Mainly provide reverse proxy service information, which generally takes up a lot of memory

Guardian Service: To prevent the main service from going down, the temporary memory usage is small.

Nginx configuration related commands:

First, open our DOS page, which can be opened in the path, which is more convenient
Insert picture description here
[External link image transfer failed. The source site may have an anti-hotlinking mechanism. It is recommended to save the image and upload it directly (img-nsIXmQwr-1584074066862) (C:\Users\苑 Asia\AppData\Roaming\Typora\typora-user-images \1584071583222.png)]

Then you can try some commonly used commands

Turn on:

start nginx

Restart:

nginx -s reload

shut down:

nginx -s stop

Try some commonly used commands

Turn on:

start nginx

Restart:

nginx -s reload

shut down:

nginx -s stop

Insert picture description here
Note that starting Nginx repeatedly will affect subsequent services!
Open the nginx configuration file:
Insert picture description here
open as shown:

 server {
    
    
       #表示监听的端口编号可以重复
        listen       80;
        #监听的服务域名不可以重复
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
		#进行反向代理  locahost关键字  / 拦截的路径  所有请求用*
        location / {
    
    
        #root关键字 默认代理的是本地磁盘路径
            root   html;
            #index 表示的是默认的启动页面
            index  index.html index.htm;
        }

The default startup interface here is index.html
Insert picture description here

Guess you like

Origin blog.csdn.net/DoChengAoHan/article/details/104838463