This is the 13th day of my participation in the August More Text Challenge.More challenges in August

What is the nginx

Nginx is a high-performance HTTP/reverse proxy server and E-mail (IMAP/POP3) proxy server.

Developed by Russian programmer Igor Sysoev, Nginx was officially tested to support up to 50,000 concurrent links,

And CPU, memory and other resources consumption is very low, very stable operation.

Nginx static server setup record:

  1. Download the Nginx zip package from the official website, decompress it in Windows, and go to the configuration file.

  2. Change the port number, the original default 80 conflict, here change to 5555(can be changed to the desired port number)

Click exe file or enter the location of the folder in CMD, execute start nginx.exe, and then enter this path, the following screen appears, it is successful.

  1. Adding configuration Items

    Add port 8081, create a resource folder (static resource folder), add the path of the resource folder to the configuration file, configure cross-domain, and click exe again

    tip:

    • Nginx does not allow the entire directory to be listed by default. To do this, open the nginx.conf file and add autoindex on to the location server or HTTP section
    • Charset UTF-8; charset UTF-8;

 server {
		listen       8081;
        server_name  resouce;
		root D:/ nginx 1.19.4 /nginx-1.194./resource;
		autoindex on;
		location / {
            add_header Access-Control-Allow-Origin *;
        }
		add_header Cache-Control "no-cache,must-revalidate";
	 }
Copy the code

Go to the path corresponding to port 8081. The resource files in the resource directory are as follows