You have your
index.html in
/var/www/htdocs? If you're adding page links, you add them as
http://server.domain/directory/file.html.
server.domain is the name you gave it in
/etc/httpd/httpd.conf (or wherever your
httpd.conf file is).
So, take a look at
httpd.conf and think about these sections:
Code:
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
#Listen 80
Listen 192.168.1.10:80
The server is fixed-IP at 192.168.1.10 and we listen on port 80.
Code:
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
ServerName fubar.com:80
This server,
fubar.com, is
not identified as
www (because it's not available to the Internet). If yours is, use the "www.example.com:80" syntax.
Code:
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Add (at least)
index.php to the
DirectoryIndex line.
Now, for example, I have Bugzilla installed. For it to work, it's in
/var/www/htdocs/bugzilla; that directory contains all the Bugzilla software.
At the bottom of
/etc/httpd/httpd.conf I have this:
Code:
# Uncomment the following line to enable Bugzilla
Include /etc/httpd/extra/httpd-bugzilla.conf
My
/etc/httpd directory contains a sub directory,
extra. The file
httpd-bugzilla.conf looks like
Code:
# Bugzilla
<Directory "/srv/httpd/htdocs/bugzilla">
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit
</Directory>
and the link to Bugzilla in
index.html is
http://fubar.com/bugzilla (yes, my server is actually named
fubar.com -- but not to the outside world because there is a
www.fubar.com. That's not a problem. Note that Bugzilla launches with
index.cgi, not
index.html or
index.php.
Note that the the address is
/srv/httpd/htdocs/bugzilla? That's what you want to use; the token "srv" is equivalent to "/var/www." You can use absolute path but it may cause problems later, best to use the default "srv."
I have another application
PHPGedView, which
is launched with
index.php in the directory
/var/www/htdocs/phpgedview and the link on
index.html points to
http://fubar.com/phpgedview. There is no additional "stuff" in
httpd.conf for PHPGedView, only the
index.php addition to the
DirectoryIndex line.
I know that's a little confusing but a PHP application works that way where something like Bugzilla (which is not a PHP application) works with CGI; different breed of kitty cat.
Too, you must have PHP enabled. In my
httpd.conf that's done with
Code:
# Uncomment the following line to enable PHP:
#
Include /etc/httpd/mod_php.conf
and that file looks like
Code:
#
# mod_php - PHP Hypertext Preprocessor module
#
# Load the PHP module:
LoadModule php5_module lib64/httpd/modules/libphp5.so
# Tell Apache to feed all *.php files through PHP. If you'd like to
# parse PHP embedded in files with different extensions, comment out
# these lines and see the example below.
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
# Tell Apache to feed all *.php, *.html, and *.htm files through
# the PHP module. Add or subtract extensions here as desired. Please
# note that running pages through PHP for no reason can be both slow
# and insecure, so be sure to know what you're doing. It's a convenient
# shortcut, but probably isn't suitible for high-traffic sites if you
# write any of your pages in straight HTML.
#<FilesMatch "\.(php|html|htm)$">
# SetHandler application/x-httpd-php
#</FilesMatch>
# This will display PHP files in colored syntax form. Use with caution.
#<FilesMatch "\.phps$">
# SetHandler application/x-httpd-php-source
#</FilesMatch>
Yours may vary but that's the basic requirement.
So, after all that stuff is taken care of you'll find that going to "http://localhost/blah" isn't the way to get to it -- just go to the actual server name and domain that you defined (here it's "fubar.com") and it'll probably work for you.
Hope this helps some.