Scenario / Questions

Is there any command to find out if apache is running or not.

and on which port except by seeingports.conf files

When i try netstat command then apaches does not appear in that.

but when i use apache2 restart command then it says restart ok

i don’t know where it is running

Find below all possible solutions or suggestions for the above questions..

Suggestion: 1

lsof -i list open ports and the corresponding applications.

For a general check if an app is running you could just use ps aux | grep apache2

Suggestion: 2
netstat -anp | grep apache

You could see the listening port and PID from this if it’s running.

Suggestion: 3
netstat -tulpn

You’ll see the Pid / Binary name on far right column, match this to your running apache instance.

Suggestion: 4

If lsof is installed you could try something like this:

lsof | grep httpd

(for centos and friends)

lsof  | grep apache

(for debian and company)

Suggestion: 5

for freebsd
sockstat | grep apache httpd