How to solve the problem when nginx prompts that the port is occupied when starting

(*-*)浩
Release: 2019-06-18 11:04:49
Original
4650 people have browsed it

Sometimes, some occupied ports may not be closed when stopping. At this time, the port will be reported as occupied when starting.

How to solve the problem when nginx prompts that the port is occupied when starting

As shown below:

[root@ZTE_OPLUS_1 nginx-1.12.0]# sh run.sh
===============================================================================
HOME=/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0
_NGINXCMD=/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0/sbin/nginx
===============================================================================
/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0
@WORK_DIR@ /oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0
@C_CMD@
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
nginx: [emerg] still could not bind()
Copy after login

The above picture reports that port 443 is occupied: use fuser -n tcp Use the command to view the list of PIDs occupying the port

fuser -n tcp 443
Copy after login

to see what is occupied. You can also use netstat -ntpl to see who is occupying it, and then KILL the occupied PID

[root@ZTE_OPLUS_1 nginx-1.12.0]# fuser -n tcp 443
443/tcp:              2330  2337  2338  2339  2340  2341
Copy after login

Use kill -9 PID to delete the process

[root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2330
[root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2337
[root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2338
[root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2339
[root@ZTE_OPLUS_1 nginx-1.12.0]# kill -9 2340
Copy after login

Then start it

[root@ZTE_OPLUS_1 nginx-1.12.0]# sh run.sh
===============================================================================
HOME=/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0
_NGINXCMD=/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0/sbin/nginx
===============================================================================
/oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0
@WORK_DIR@ /oplusapp/PMSCMDB/ums-server/utils/nginx/nginx-1.12.0
@C_CMD@
Copy after login

For more Nginx related technical articles, please Visit the Nginx usage tutorial column to learn!

The above is the detailed content of How to solve the problem when nginx prompts that the port is occupied when starting. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template