I am trying to host multiple websites from my linux box. I have been from one end of google to the other and tried about every suggestion I could read. I have also tried setting up webmin and have edited and re-edited my httpd.conf to death. I have one web site running now in the /var/www/ directory. I would like to host a few more in other directory's either by /home/user/public or /var/www/user/ I dont care. I have been able to get it half way working however I cannot seem to get rid of the default redhat index page. And usually the default website in the var/www/ starts pointing at the default redhat index page instead of my /var/www/html/index.html page.

Any help would be great.

14 Years
Discussion Span
Last Post by vrecan

Thank you for responding. I wasnt sure if I should put the whole thing as a message so I am attaching txt file..

## httpd.conf - configuration for the Apache web server
# Generated automatically... if you edit manually, the changes will be lost
# the next time you run "redhat-config-httpd".

### Section 1: Global Environment
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.

# Don't give away too much information about all the subcomponents
# we are running.  Comment out this line if you don't mind remote sites
# finding out what major optional modules you are running
ServerTokens OS

# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation
# (available at 
# you will save yourself a lot of trouble.
# Do NOT add a slash at the end of the directory path.
ServerRoot "/etc/httpd"

# ScoreBoardFile: File used to store internal server process information.
# If unspecified (the default), the scoreboard will be stored in an
# anonymous shared memory segment, and will be unavailable to third-party
# applications.
# If specified, ensure that no two invocations of Apache share the same
# scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.
#ScoreBoardFile run/httpd.scoreboard

# PidFile: The file in which the server should record its process
# identification number when it starts.
PidFile "/var/run/httpd.pid"

# Timeout: The number of seconds before receives and sends time out.
TimeOut 300

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
KeepAlive false

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
MaxKeepAliveRequests 100

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
KeepAliveTimeout 15

## Server-Pool Size Regulation (MPM specific)

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
MaxClients 150
MaxRequestsPerChild 100

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server 
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to 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 *:80

# Dynamic Shared Object (DSO) Support
# To be able to use the functionality of a module which was built as a 
DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
# Example:
# LoadModule foo_module modules/mod_foo.so
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so

# Load config files from the config directory "/etc/httpd/conf.d".
Include conf.d/*.conf

# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#ExtendedStatus On

### Section 2: 'Main' server configuration
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.

# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
# User/Group: The name (or #number) of the user/group to run httpd as.
#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".
#  . On HPUX you may not be able to use shared memory as nobody, and the
#    suggested workaround is to create a user www and use that user.
#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
#  when the value of (unsigned)Group is above 60000;
#  don't use Group #-1 on these systems!
User apache
Group apache

# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
ServerAdmin webmaster@raymondjordan.com

# ServerName gives the name and port that the server uses to identify 
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
# If your host doesn't have a registered DNS name, enter its IP address 
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
ServerName localhost

# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client.  When set "On", Apache will use the value of the
# ServerName directive.
UseCanonicalName on

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot "/var/www/html"

# Disable autoindex for the root directory, and present a
# default Welcome page if no other index page is present.
<LocationMatch "^/$">
    Options -Indexes
    ErrorDocument 403 /error/noindex.html

# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid.  This usually means that ~userid
# mu

I'll take a look at it and get back to you later tonight. I already know the answer to one problem, but I want to verify this by checking your .conf file. As far as hosting multiple domains, again, I'll look at your current config and let you know what was wrong. If I'm in a good mood, I'll even edit for you and repost it to save you some trouble :)


Sorry I haven't replied yet, but I did take a look through your conf file, and it appears there's a number of things that are misconfigured, which would explain why you're having trouble with vhosts (multiple domains), among other things...

I would suggest taking a look at the online Apache documentation to get a better understanding on how virtual domain hosting works, which will help you understand how Apache handles it. Rather than just fixing your .conf file to make it "work" like you want, if you don't understand what you're doing, you won't know how to fix/make changes to it when you need to.

Here's the URLs for the docs you need, which should already be included in the "Manual" section included with Apache:

Configuration Sections:

Virtual Host Documentation:

Apache 2.0 Root Documentation:

In order to get rid of the default RedHat page like you want, you have to reconfigure your httpd.conf without any extras FIRST to make sure the basics work, then move on one step at a time and add features. I highly recommend trashing your existing config file and starting with a fresh copy (# cp httpd.conf.sample httpd.conf) which will contain an alias to the /docs ("Manual") directory.

Also, an error I see a lot is the ServerName variable entry. If you set that as "localhost", you'll have to access it by entering http://localhost as the URL. If you want outside access to your server, use www.mydomain.com as the ServerName:

ServerName www.mydomain.com

Another variable is the Listen variable. If you want Apache to listen for requests on port 80, then just enter 80 for the variable:

Listen 80

I'm not trying to shrug off your request for help, but it's important that you understand what you're doing when configuring any type of server. A misconfigured web server can lead to a compromised system, and create a ton of other problems from there (using your box as a platform to launch DDoS attacks, etc.)

Read the docs, and test it out. You should have it up and running in no time at all - certainly within 15 to 30 minutes or so. It's not very difficult, but if you still have problems, let me know.


Thank you for your help. I have taken a look at the apache links. I will scrap the old conf file and build using the information contained. I am sure I will be posting for more help. I really appreciate the assistance.


thanks TheOgre, those links seem good. They will come in handy for me aswell.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.