Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just taken over webmastery for my company's site, and I'm preparing a report for my partner about the LAMP stack. But I'm a new CS graduate, and the only thing I know really well is Java coding, so I need some help!

I'm trying to find out a) if Apache is installed and b) what version is running.

My Linux version is "Ubuntu 8.04.4 LTS \n \l", as reported by /etc/issue.

share|improve this question
up vote 19 down vote accepted

Is it running?

pgrep apache

Any output is good, nothing means it isn't running.

What version:

aptitude show apache2
share|improve this answer
pgrep apache produces 11 lines of output. – Iain Elder Sep 3 '10 at 22:18
aptitude show apache2 produces lots of output, including the line Version: 2.2.8-1ubuntu0.15. – Iain Elder Sep 3 '10 at 22:20
Thank you, this seems to answer my question! – Iain Elder Sep 4 '10 at 2:14
apache2 -version in a shell would also work. – Marc B Sep 5 '10 at 6:24

Have you tried talking to it?

telnet localhost 80
<extra carriage return>
share|improve this answer
telnet localhost 80 produces -bash: telnet: command not found – Iain Elder Sep 3 '10 at 22:10
You should consider installing it or something with similar functionality such as ncat (part of nmap 5). Talking directly to your web (or SMTP or POP or IMAP or SIP or FTP or …) server can be indispensable for troubleshooting. – Gerald Combs Sep 7 '10 at 15:28

To check for Apache 1.X see below, for Apache 2.X see wzzrd's answer.

The apache web server process is called httpd so a quick way to start with confirming apache is installed and running is:

ps -A | grep 'httpd'

ps -A lists all the running processes grep 'httpd' filters only lines containing 'httpd'

If you don't get any results, apache is not running.

regarding version, try:

apachectl status

in the output there should be a line like:
Apache/1.3.41 Server at Port 80

If it cannot find apachectl, it may not be in your execution path, try:
whereis apachectl
to see where it is located

These are distribution agnostic ways so no matter how apache was installed on the system, you should find it with these.

share|improve this answer
"ps -A | grep 'httpd'" produces no output. – Iain Elder Sep 3 '10 at 22:07
"apachectl status" produces "-bash: apachectl: command not found" – Iain Elder Sep 3 '10 at 22:08
"whereis apachectl" produces "apachectl:" – Iain Elder Sep 3 '10 at 22:09
However, ps -A | grep apache2 produces ` 2691 ? 00:00:01 apache2` and 10 other apache2 processes. – Iain Elder Sep 3 '10 at 22:14
@isme, actually, that isn't a distribution issue but an apache major version issue. I was referencing a box with apache 1.x on it. The instructions would have worked on Ubuntu with apache 1.x and the other answer would have not produced a result. – ManiacZX Sep 6 '10 at 17:28

Click here: http://localhost If you don't get an error 404, it's running.

share|improve this answer
My server instance is a VPS, so I can't just click a link on my local machine to check whether it's running. – Iain Elder Sep 4 '10 at 2:12
You could run some ncurses web browser like links or lynx directly on the server. – halp Sep 4 '10 at 3:48
/sbin/service httpd status

Will say that you don't have it | it's OK | it's OFF

share|improve this answer
/sbin/service httpd status produces -bash: /sbin/service: No such file or directory – Iain Elder Sep 3 '10 at 22:11

For Apache/2.2.22 you can also try. It will show you a few processes.

ps -A | grep 'apache'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.