如何检查哪个Apache端口正在运行


19

是否有任何命令来查找apache是​​否正在运行。

以及在哪个端口上(除了seeingports.conf文件)

当我尝试netstat命令时,apache不会出现在其中。

但是当我使用apache2 restart命令时,它说重启正常

我不知道它在哪里运行

Answers:


18

lsof -i 列出打开的端口和相应的应用程序。

对于一般检查应用程序是否正在运行,您可以使用 ps aux | grep apache2


7
或对于Redhat / centos使用“ ps aux | grep httpd”。
lg。

21
netstat -anp | grep apache

如果正在运行,您可以从中看到侦听端口和PID。


须藤netstat -anp | grep apache
Laukik Patel 2015年

它在“本地地址”列中显示0.0.0.0:80。这是否意味着apache在端口80上的机器的相同IP地址上运行?
Rodrigo 2015年

3
netstat -tulpn

您将在最右边的列中看到Pid / Binary名称,并将其与您正在运行的apache实例匹配。


3

如果安装了lsof,则可以尝试执行以下操作:

lsof | grep httpd

(针对centos和朋友)

lsof  | grep apache

(用于debian和company)


0

for freebsd sockstat | grep apache httpd

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.