As shown in the figure:
View port occupancy:
sudo netstat -apn | grep 80
To view processes occupying ports:
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 started successfully. Enter the ip address of the system where nginx is located in the browser to verify whether nginx started successfully.
The following describes the start, stop and restart of nginx.
start
Startup code format: nginx installation directory address-Cninx configuration file address
For example:
2. Kill the process
Quick stop
1. Check the process number
2. Kill the process
Forced stop
Method 2: add -t before the start command-c.
2. Method 1 of restarting nginx service: 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 nginx service.
Copyright Description:No reproduction without permission。
Knowledge sharing community for developers。
Let more developers benefit from it。
Help developers share knowledge through the Internet。
Follow us