NGINX startup error, the port is occupied

NGINX startup error, port occupied solution (modify the port number)
  Nginx (engine x) is a high-performance HTTP and reverse proxy server, as well as an IMAP/POP3/SMTP server. Nginx was developed by Igor Sysoyev for the second most visited Rambler.ru site in Russia (Russian: Рамблер).
  It is also a lightweight web server that can be used as an independent server to deploy websites (similar to Tomcat). Its high performance and low memory consumption structure is favored by many large companies, such as the construction of Taobao website.
Installation steps
1. Download Nginx
Download address: http://nginx.org/en/download.html (Nginx official website)
2. After downloading, unzip to the specified directory, and you can see the following directory
insert image description here

3. Switch the console (CMD) to the Nginx directory, enter start nginx, and then enter localhost on the browser page. If the following interface appears, it means the installation is successful.
insert image description here

By default, it listens on port 80. (Instructions for starting nginx command: It should be noted that since the default port of nginx is also port 80, if Apache or IIS service is enabled on your machine at this time, do not shut down IIS or Apache service before starting nginx, otherwise the nginx startup command will not succeed .Modify the default port number of nginx, and the default port number of my nginx is changed to 81.)
insert image description here
Just enter nginx directly in the cmd under this path.
insert image description here

Then open the link: http://localhost:81/ .
If it can be opened, it proves ok

4. Introduction to nginx commands
(1) start nginx to start the nginx service
(2) nginx.exe -s stop to close the nginx service, stop nginx quickly, and may not save relevant information
(3) nginx.exe -s quit to close the nginx service, complete Stop nginx in an orderly manner and save relevant information
(4) nginx.exe -s reload to reload the nginx service. When you change the nginx configuration information and need to reload these configurations, you can use this command to reload nginx
(5) nginx -s reopen Reopen the log file command
(6) nginx -v
The difference between nginx command parameters v and V
  The nginx -v command simply displays the nginx version information (nginx version)
  nginx -V not only displays the nginx version information, but also nginx configuration parameter information.
(7) nginx -c </path/to/config>
  This command parameter specifies a new nginx configuration file to replace the default nginx configuration file. If you are not sure whether the syntax of the new nginx configuration file is correct, you can pass the nginx command -t parameter to test, the -t parameter means not to run the configuration file, but just to test the configuration file, that is, nginx -t -c </path/to/config>Problem
solution
1. Can't close nginx?
(1) After nginx -s stop, use the task manager to see if there is still nginx.exe process
(2) Execute netstat -an|find "0:80" on the cmd command line to see if the port is still open
(3) If there is no process and the port is not open, it means that you are accessing the browser cache, and F5 refreshes it. (4
) You can use the taskkill /F /IM nginx.exe > nul command to forcibly shut down all nginx (possibly There are multiple nginx open)

Guess you like

Origin blog.csdn.net/qq_42373007/article/details/119089449