The company's development environment is nginx, and it often encounters some situations where nginx cannot be started. Baidu once, find a method and record it, which is also convenient for people with the same troubles.
Sometimes the Nginx service cannot be started because port 80 is occupied by other applications. In this case, we need to check which program occupies it, which may be a site in IIS or Tomat, apache and so on are all possible. Therefore, we need to check the usage of port 80 on the computer and use the following command:
Netstat-aon | findstr ": 80 & Prime;
At this time, we did not see that the machine is occupied by processes with PID 4, and found it in the task manager.
Shut down the 80 terminal and then run our nginx service.
In addition, we need to know three major commands for nginx:
Start Service: start nginx
Stop Service: nginx-s stop
Reload: nginx-s reload (the configuration file needs to be executed after it is modified)