How to check if nginx port is occupied

(*-*)浩
Release: 2019-11-01 13:33:17
Original
15285 people have browsed it

How to check if nginx port is occupied

First check the nginx configuration

Check which ports are used in the nginx configuration and whether port numbers commonly used by other programs are used. Generally speaking, nginx is used as an http server or reverse proxy server. The most commonly used ports are http port 80 and https port 433. If other ports are used in the configuration, especially those below 1024, it is recommended to modify the port configuration. (Recommended learning:nginx tutorial)

Find the process occupying the port

If you confirm that the nginx port configuration is correct, then change the current Find the process occupying the port. Modern operating systems can query process information based on port numbers. Taking Linux as an example, you can use the lsof or netstat command to query the processes occupying the port.

How to check if nginx port is occupied

Use the lsof command to query the port occupying process

How to check if nginx port is occupied

Use the netstat command to query the process occupying the port

Resolve the conflict according to the actual situation

After finding the process occupying the port, first determine whether the process is the same as the one occupying the port. nginx relationships and priorities.

If this process is nginx itself, it means that nginx has already been started and nginx cannot be started repeatedly;

If this process is a process that nginx wants to proxy or does not provide services to the outside world, you can modify this process. Configuration, let it use other ports, and then restart;

If this process has provided services to the outside world and cannot be modified, you need to modify the nginx related configuration to let nginx use other ports;

If This is a process you don't recognize, so be careful. The server may be under attack and needs to be killed and fully disinfected.

The above is the detailed content of How to check if nginx port is occupied. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!