Page 1 of 3

Error 404 HTTP not found

Posted: Mon Apr 01, 2013 9:29 am
by devilsguest
I have installed apache 2.2.24 on my linux box and have both my nagios service, Apache service up and running. But I don't see any communication between them. My page directly kicks back me to error 404 when typed the url http://localhost or ip/nagios. Conf file has no issues.....can some one help me out. Please look into the attached how the url looks like....

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 10:15 am
by abrist
Is apache running?

Code: Select all

ps -A | grep 'httpd'
service httpd status
Is port 80 open?

Code: Select all

nmap localhost -p 80
Is nagios running?

Code: Select all

ps -A | grep 'nagios'
service nagios status

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 11:02 am
by devilsguest
ps -A | grep 'httpd'

Code: Select all

4029 ?        00:00:00 httpd
16991 ?        00:00:00 httpd
12452 ?        00:00:00 httpd
12454 ?        00:00:00 httpd
12456 ?        00:00:00 httpd
14672 ?        00:00:00 httpd
14673 ?        00:00:00 httpd
14674 ?        00:00:00 httpd
14675 ?        00:00:00 httpd
14676 ?        00:00:00 httpd
14677 ?        00:00:00 httpd
15076 ?        00:00:00 httpd
15104 ?        00:00:00 httpd
15106 ?        00:00:00 httpd
23743 ?        00:00:00 httpd
31367 ?        00:00:00 httpd
10631 ?        00:00:00 httpd
10632 ?        00:00:00 httpd
10633 ?        00:00:00 httpd
10634 ?        00:00:00 httpd
10635 ?        00:00:00 httpd
10651 ?        00:00:00 httpd
nmap localhost -p 77

Code: Select all

Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2013-04-01 11:59 EDT
Interesting ports on localhost.localdomain (127.0.0.1):
PORT   STATE SERVICE
77/tcp open  priv-rje
Nmap run completed -- 1 IP address (1 host up) scanned in 0.125 seconds
ps -A | grep 'nagios'

Code: Select all

14151 ?        00:00:04 nagios
10717 ?        00:00:00 nagios

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 11:07 am
by abrist
Are you browsing to port 77 or do you have a redirect to port 77 from port 80? (i.e. http://nagios_server_ip:77)
If so, then your problem, unfortunately, most likely lies in your apache config.

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 11:10 am
by lmiltchev
It seems like port 80 is not open. You should see:

Code: Select all

PORT   STATE SERVICE
80/tcp open  http

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 12:05 pm
by devilsguest
I am using port 77 to browse there are no redirect ports. I have changed the port number.Here, I am not using default port. Probably, I don't think changing port number would make a difference while browsing.

Here I have a question.....why is apache trying to extract nagios webconf file from its htdocs file? I think I found the issue but don't really know where to change the path for apache to communicate with nagios to display the home page.

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 12:44 pm
by lmiltchev
Just curious - is SELinux enabled on this box? If it is, can you try disabling it and see if this is going to help?

Code: Select all

setenforce 0

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 1:30 pm
by devilsguest
did the command you sent but doesn't make any difference to my file............

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 1:42 pm
by abrist
Post the output of the following:
Where is your config and how was it parsed?

Code: Select all

httpd -S
Where is your "ServerRoot"?

Code: Select all

cat /path/to/httpd.conf | grep ServerRoot
Have you declared:

Code: Select all

Listen 77
in your httpd.conf?

Code: Select all

cat /path/to/httpd.conf | grep Listen

Re: Error 404 HTTP not found

Posted: Mon Apr 01, 2013 2:00 pm
by devilsguest
httpd -S
-bash:httpd:command not found
path to httpd.conf

Code: Select all

 exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock logs/cgisock
</IfModule>

#
# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>

<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>


ScriptAlias /nagios/cgi-bin/ "/usr/local/nagios/sbin/"
<Directory "/usr/local/nagios/sbin/">
AllowOverride None
Options ExecCGI
Allow from all
Order allow,deny
AuthName "Nagios Access"
Authtype Basic
AuthUserFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
</Directory>

ScriptAlias /nagios/ "/usr/local/nagios/share/"
<Directory "/usr/local/nagios/share">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
Authtype Basic
AuthUserFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
</Directory>
path to httpd.conf | grep ServerRoot

Code: Select all

# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# with ServerRoot set to '/www' will be interpreted by the
# ServerRoot: The top of the directory tree under which the server's
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk.  If you wish to share the same ServerRoot for multiple
ServerRoot "/usr/local/apache2"
Listen 77
-bash:Listen:Command not found
So I did
netstat -an | grep 77

Code: Select all

EN
tcp        0      0 :::77                       :::*                        LIST