In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
The purpose of this article is to tell you what to do when opening Nginx when the port is occupied. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
As shown in the figure:
View port occupancy:
Sudo netstat-apn | grep 80
View the processes that occupy the port:
Ps-ef | grep 3345
The result shows that port 80 is occupied by Nginx itself, so you can kill the process and restart Nginx.
Sudo kill-9 3345
Sudo netstat-apn | grep 80
After successfully killing the process, start Nginx
Nginx is started successfully. Enter the ip address of the system where Nginx is located in the browser to verify whether Nginx is started successfully.
The following describes the start, stop and restart of Nginx
Start
Startup code format: nginx installation directory address-c nginx configuration file address
For example:
[root@LinuxServer sbin] # / usr/local/nginx/sbin/nginx-c / usr/local/nginx/conf/nginx.conf
Stop it
There are three ways to stop nginx:
Stop calmly
1. Check the process number
[root@LinuxServer ~] # ps-ef | grep nginx
2. Kill the process
[root@LinuxServer ~] # kill-QUIT 2072
Quick stop
1. Check the process number
[root@LinuxServer ~] # ps-ef | grep nginx
2. Kill the process
[root@LinuxServer ~] # kill-TERM 2132 or [root@LinuxServer ~] # kill-INT 2132
Forced stop
[root@LinuxServer] # pkill-9 nginx
Restart
1. Verify that the nginx configuration file is correct
Method 1: enter the nginx installation directory sbin and enter the command. / nginx-t
See the following display of nginx.conf syntax is ok
Nginx.conf test is successful
Indicates that the configuration file is correct!
Method 2: add-t before the startup command-c
2. Restart the Nginx service method 1: enter the nginx executable directory sbin and enter the command. / nginx-s reload
Method 2: find the current nginx process number, and then enter the command: kill-HUP process number to restart the nginx service
Thank you for reading! This is the end of the article on "what to do when the port is occupied when opening Nginx". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.