Install and use nginx under windows

1. Download

Download the stable version from the official website .
Insert picture description here

Just unzip it. After decompression, you can see the following directory.
Insert picture description here

2. Start

There are many ways to start nginx.

(1). Double-click nginx.exe directly.

(2). Open the cmd command window, switch to the decompression directory of nginx, and enter the command nginx.exe or start nginx.

3. Check whether nginx has started successfully

(1). Directly enter the URL http://localhost/:80 in the browser, the following figure appears, indicating that the startup is successful.
Insert picture description here
(2). Enter tasklist /fi "imagename eq nginx.exe" in the cmd command window, the following means the startup is successful.
Insert picture description here
The configuration file of nginx is nginx.conf in the conf directory. The port that nginx listens on by default is 80. If port 80 is occupied, it can be changed to an unoccupied port.

The command to check whether port 80 is occupied is: netstat -ano | findstr 0.0.0.0:80 or netstat -ano | findstr "80".

When we modify the nginx configuration file nginx.conf, there is no need to close nginx and restart nginx, just execute the command nginx -s reload to make the changes take effect.
Insert picture description here

4. Close nginx

If you use the cmd command window to start nginx, closing the cmd window will not end the nginx process, you can use two methods to close nginx.

(1). Enter the nginx command nginx -s stop (quickly stop nginx) or nginx -s quit (complete and orderly stop nginx)

(Quickly stop nginx) or nginx -s quit (stop nginx completely and orderly)

(2). 使用taskkill taskkill /f /t /im nginx.exe

Guess you like

Origin blog.csdn.net/hello_cmy/article/details/108710796