Configuration d’un serveur Web Apache
Le but de l’exercice est d’héberger les sites Web des entreprises
suivantes sur notre serveur Web. Il s’agit de :
MONDOMAIN qui aura pour site Web www.mondomain.ci
ADAD qui aura pour site web www.adad.ci
SOURCE qui aurrra pour site web www.source.com
1. Le fichier de configuration du
serveur Apache sous redhat est :
/etc/httpd/conf/httpd.conf
2. Editons le fichier pour la
configuration du serveur
Vi /etc/httpd/conf/httpd.conf
#
# Do NOT add a slash at the end of the
directory path.
#
ServerRoot "/etc/httpd"
#
# PidFile: The file in which the server
should record its process
# identification number when it starts.
#
PidFile run/httpd.pid
#
# Timeout: The number of seconds before
receives and sends time out.
#
Timeout 120
#
# 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 (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80
#
# Load config files from the config
directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf
# 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 root@localhost
#
# 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 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 here.
# You will have to access it by its
address anyway, and this will make
# redirections work in a sensible way.
#
#ServerName new.host.name:80
ServerName mail12.cfitnet.ci:80
#
# 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 Off
#
# 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"
#
# Each directory to which Apache has
access can be configured with respect
# to which services and features are
allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the
"default" to be a very restrictive set of
# features.
#
# The index.html.var file (a type-map)
is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var
# ErrorLog: The location of the error
log file.
# If you do not specify an ErrorLog
directive within a <VirtualHost>
# container, error messages relating to
that virtual host will be
# logged here. If you *do* define an error logfile for a
<VirtualHost>
# container, that host's errors will be
logged there and not here.
#
ErrorLog logs/error_log
# The location and format of the access
logfile (Common Logfile Format).
# If you do not define any access
logfiles within a <VirtualHost>
# container, they will be logged
here. Contrariwise, if you *do*
# define per-<VirtualHost> access
logfiles, transactions will be
# logged therein and *not* in this
file.
#
#CustomLog logs/access_log common
#
# If you would like to have agent and
referer logfiles, uncomment the
# following directives.
#
#CustomLog logs/referer_log referer
#CustomLog logs/agent_log agent
#
# For a single logfile with access,
agent, and referer information
# (Combined Logfile Format), use the
following directive:
#
CustomLog logs/access_log combined
#
# Optionally add a line containing the
server version and virtual host
# name to server-generated pages (internal
error documents, FTP directory
# listings, mod_status and mod_info
output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also
include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain
multiple domains/hostnames on your
# machine you can setup VirtualHost
containers for them. Most configurations
# use only name-based virtual hosts so
the server doesn't need to worry about
# IP addresses. This is indicated by
the asterisks in the directives below.
#
# Please see the documentation at
#
<URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to
setup virtual hosts.
#
# You may use the command line option
'-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
# NameVirtualHost *:80
NameVirtualHost mail12.cfitnet.ci:80
#
# NOTE: NameVirtualHost cannot be used
without a port specifier
# (e.g. :80) if mod_ssl is being used,
due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go
into a VirtualHost container.
# The first VirtualHost section is used
for requests without a known
# server name.
#
#<VirtualHost *:80>
#
ServerAdmin
webmaster@dummy-host.example.com
# DocumentRoot
/www/docs/dummy-host.example.com
#
ServerName dummy-host.example.com
#
ErrorLog logs/dummy-host.example.com-error_log
#
CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
<VirtualHost www.mondomain.ci:80>
ServerAdmin webmaster@mondomain.ci
DocumentRoot /home/mondomain
ServerName
www.dmondomain.ci
ErrorLog
logs/mail.cfitnet.ci-error_log
CustomLog /var/log/httpd/access_log
common
</VirtualHost>
<VirtualHost www.adad.ci:80>
ServerAdmin
webmaster@adad.ci
DocumentRoot
/home/adad
ServerName
www.adad.ci
ErrorLog
logs/mail.cfitnet.ci-error_log
CustomLog /var/log/httpd/access_log
common
</VirtualHost>
<VirtualHost www.source.com:80>
ServerAdmin
webmaster@adad.ci
DocumentRoot
/homew/source
ServerName
www.source.com
ErrorLog
logs/mail.cfitnet.ci-error_log
CustomLog /var/log/httpd/access_log
common
</VirtualHost>
·
Création des repertoires d’hébergement
Ces répertoires seront crées dans /home
La commande est la suivante pour mondomain : mkdir mondomain
Nous allons procéder de même pour adad.ci
et source.com
Il faut ensuite appliquer les
droits d’accès aux repertoires avec la commande suivante : chmod 777 adorass pour mondomain
Faire de même pour les autres répertoires
·
Démarrage du serveur Apache
Service httpd start
·
Test du serveur Apache
Lancez le navigateur de votre choix
sur un des postes clients de votre réseau après avoir fait les
configurations tcp/ip nécessaires puis dans la barre d’adresse
tappez http://www.mondomain.ci/ vous devrez voir apparaitre la page de
test du serveur Web apache s’afficher.
Faire
de même pour www.adad.ci et www.source.com
Aucun commentaire:
Enregistrer un commentaire