cancel
Showing results for 
Search instead for 
Did you mean: 

Linux Apache server

Clarence J
Frequent Advisor

Linux Apache server

Hi All,

How do I know if I have the Linux Apache server installed on my box? I've seen a few apache files lying around the server but I don't know if the web server is active. If it is not, how do I install it?
6 REPLIES
Mike Hassell
Respected Contributor

Re: Linux Apache server

Clarence,

To determine if apache is running on the box, issue the following command:

ps aux | grep httpd

It should list a few httpd processes running that are waiting for connections. Depending on what distribution of linux you're running apache will be located in different directories. You can start and stop the apache server using the shell script 'apachectl'. To find this script issue the follwoing command:

find / -name apachectl -print

Once you find the script run it with the start command and apache will start. Use the following link for a reference to help you out:

http://httpd.apache.org/docs/invoking.html

You can also just open a web browser and point it to the address of the server and see if any pages come up or if the server responds at all.

By the way, Apache 1.3.20 is now out and can be downloaded from the follwoing address:

http://httpd.apache.org/dist/httpd/

If you are running Redhat or another major distrubution you can download a pre compiled version (.rpm). Hope that helps.

- Mike
The network is the computer, yeah I stole it from Sun, so what?
Calvin Dodge
Advisor

Re: Linux Apache server

If you're using Red Hat, type "rpm -qi apache" at the command line.

(this may work for other RPM-based distros (like Mandrake), too)

if rpm responds with "package apache not installed", then you need to install the apache rpm.

If it is installed, then you can start it (as root) with "/etc/rc.d/init.d/httpd start".

If you want it to start automatically when you start the computer, then type "chkconfig --add httpd". That creates links to apache's startup script.

FWIW, "apachectl" isn't part of the Red Hat distro (I suspect it's not in other RPM-based distros, eikther).
Clarence J
Frequent Advisor

Re: Linux Apache server

I tried httpd start but got the following error msg:

httpd: cannot determine local host name.
Use the ServerName directive to set it manually.

How do I resolve the above?

Thanks for your help!
Calvin Dodge
Advisor

Re: Linux Apache server

Apache is doing a reverse DNS lookup - trying to find the machine's name from its IP address.

You can either set up DNS locally on your network (create a phony local domain and add entries for your Linux box), or use the ServerName directive.

To do the latter, edit /etc/httpd/conf/httpd.conf and search for "ServerName". Uncomment it (remove the "#" character in front of it) and put the name after it (you'll want a fully-qualified name, like "www.mynetwork.local")
Deno
Occasional Visitor

Re: Linux Apache server

With mandrake linux, the easiest thing to do is type

urpmi apache

to install apache, followed by:

service httpd start

to be sure apache is running. you should be able to see a default page by contacting to http://localhost.localdomain imediately...

In case you don't like command line, the same can be done with GUI tools in mandrake Control center
Jeffrey S. Sims
Trusted Contributor

Re: Linux Apache server

Here is an excerpt from the httpd.conf file that needs to be configured for apache to run correctly. The server name directive that is referred to in your error is addressed here.

#
# ServerName: allows you to set a host name which is sent back to clients for
# your server if it's different than the one the program would get (i.e., use
# "www" instead of the host's real name).
#
# Note: You cannot just invent host names and hope they work. The name you
# define here must be a valid DNS name for your host. If you don't understand
# this, ask your network administrator.
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address (e.g., http://123.45.67.89/)
# anyway, and this will make redirections work in a sensible way.
#
ServerName intweb.interex.org

This should fix your problem