Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I had installed Apache2 before, and now when I tried running it again, it doesn't.
My Apache2 settings are:

jatin@jatin-ubuntu:/var/run$ apache2 -V
Server version: Apache/2.2.14 (Ubuntu)
Server built:   Nov 18 2010 21:17:19
Server's Module Magic Number: 20051115:23
Server loaded:  APR 1.3.8, APR-Util 1.3.9
Compiled using: APR 1.3.8, APR-Util 1.3.9
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT=""
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"

When I do this, the following errors come up:

jatin@jatin-ubuntu:/var/run$ httpd status
No command 'httpd' found, did you mean:
 Command 'dhttpd' from package 'dhttpd' (universe)
 Command 'xttpd' from package 'xtide' (universe)
 Command 'thttpd' from package 'thttpd' (universe)
httpd: command not found

My /etc/apache2/ports.conf looks like:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

#NameVirtualHost *:80
Listen 80

#<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
#    Listen 443
#</IfModule>

#<IfModule mod_gnutls.c>
#    Listen 443
#</IfModule>

My sites-available directory has these two files:

jatin@jatin-ubuntu:/etc/apache2$ cd sites-available/
jatin@jatin-ubuntu:/etc/apache2/sites-available$ ls
default  default-ssl

When I look into sites-enabled directory, it has nothing:

jatin@jatin-ubuntu:/etc/apache2/sites-available$ cd ../sites-enabled/
jatin@jatin-ubuntu:/etc/apache2/sites-enabled$ ls

My /var/log/apache2/error.log file shows this:

[Sat Mar 26 17:54:08 2011] [error] [client 127.0.0.1] File does not exist: /htdocs
[Sat Mar 26 17:54:15 2011] [error] [client 127.0.0.1] File does not exist: /htdocs
[Sat Mar 26 17:54:23 2011] [notice] caught SIGTERM, shutting down
[Sat Mar 26 17:54:26 2011] [notice] Apache/2.2.14 (Ubuntu) DAV/2 SVN/1.6.6 configured -- resuming normal operations

I read on Web that this has got to do something with the Server root not properly set and therefore it looks for the /htdocs folder.

QUESTIONS:

  1. Why does the httpd status doesn't show anything??
  2. Is everything in my ports.conf file correct?? I have just one line uncommented for the Listen.
  3. Aren't there supposed to be sym links for the default in the sites-enabled directory???
  4. When I do sudo /etc/init.d/apache2 restart/stop/start everything works fine, but nothing shows up when I open http://localhost/ or http://localhost:80/ or http://localhost:8080/???
  5. What is this thing with Server Root and have i set it correct??
share|improve this question

migrated from superuser.com Mar 26 '11 at 14:06

This question came from our site for computer enthusiasts and power users.

2 Answers 2

up vote 2 down vote accepted
  • Why does the httpd status doesn't show anything?

Because you do not have httpd installed. Perhaps you meant /etc/init.d/httpd status? The equivalent command on an Ubuntu system is /etc/init.d/apache2 status.

  • Is everything in my ports.conf file correct?

If you are only going to run one site then it should be ok. If you want to have more sites running as virtualhosts you will need to uncomment the NameVirtualHost line too.

  • Aren't there supposed to be sym links for the default in the sites-enabled directory?

They are created when you use the a2ensite command to enable a site e.g.

a2ensite default

will enable the default website by creating the link.

  • When I do sudo /etc/init.d/apache2 restart/stop/start everything works fine...

Looking at the error messages in your question, they would indicate that you are not seeing nothing. You will be seeing a 404 Not Found error message. This is caused because you do not have any sites enabled.

  • What is this thing with Server Root and have I set it correct

I suspect that you mean DocumentRoot, if there is no DocumentRoot configured then Apache defaults to /htdocs. Enable a site using the command above and see what happens. You should get a message saying something like "It Works ..."

share|improve this answer
    
Thanks. a2ensite default worked. Can you guide me to a article on how to use virtual hosts using Apache. –  Jatin Ganhotra Mar 26 '11 at 20:25
    
@Jatin: articles.slicehost.com/2010/5/19/… –  Iain Mar 26 '11 at 20:31

I remember some service awhile back complained and said "hey this won't work in the future - you should use service something stop/start/restart"
I thought it was apache but when I ran:

sudo /etc/init.d/apache2 restart

It didn't give that warning message today, but I think you can also do

sudo service apache2 restart

I would check /etc/apache2/sites-available/default and make sure the document root is set to:

DocumentRoot /var/www

Did you install Apache using tasksel or during install?

share|improve this answer
    
I checked /etc/apache2/sites-available/default and yes the Document Root is set to /var/www. I don't remember if I installed apache using tasksel, i guess i didn't, anyways would it make a difference? –  Jatin Ganhotra Mar 26 '11 at 14:19

Your Answer

 
discard

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.