Home>Article>Operation and Maintenance> How to solve the problem when nginx prompts that the port is occupied when starting

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

(*-*)浩
(*-*)浩 Original
2019-06-10 16:09:33 4549browse

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()

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

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

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

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@

For more Nginx related technical articles, please Visit theNginx usage tutorialcolumn 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!

Statement:
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