Specific steps to use nginx on Windows

① First download the Windows version of nginx

http://nginx.org/en/docs/windows.html

②Decompress the file directly, and then execute cmd directly in the same directory as nginx.exe. Of course, you can also double-click the file in the red box in the figure below to start nginx, but there is a problem with this method. If There is no problem with your configuration file.

insert image description here
Of course, you can troubleshoot errors by looking at the error logs under the logs folder in nginx.
insert image description here

③ Configuration file explanation

There is a conf folder under the nginx package, and the nginx.conf configuration file below, open the file. As shown below:

insert image description here
Among them, listen listens to port 80, which is the port occupied by nginx.
server_name is the ip address for accessing the nginx.
location is the address path accessed on the web page.
proxy_pass is the corresponding forwarding path of nginx when accessing the appeal path.

The function of nginx is to visit http:localhost:80/nginx on the web page and
the address forwarded by nginx is http://127.0.0.1:8080/nginx/

注意: proxy_pass 最后面一定要带分号 ;,要不nginx是无法启动的

④ Start the service

Note that there is a problem with this method that the startup is very slow, or it cannot be started, but when there is a problem with your configuration file, it will prompt you where it is wrong.
insert image description here
If the above method is difficult to start, you can directly double-click nginx.exe.

Look in the task manager, if you can see the red box, it means the startup is successful.
insert image description here

Guess you like

Origin blog.csdn.net/PhilsphyPrgram/article/details/125369439