Implantation

Ce tutoriel développe la mise en place d'un serveur Web Apache2 fonctionnant avec des hôtes virtuels HTTP et HTTPS sur le même serveur. Les modules SSL, PHP, Perl et CGI seront utilisés.



Installation des packages

Image5

Image6

apache2-modules-2.0.50-7.2.101mdk
apache2-mod_cache-2.0.50-7.2.101mdk
apache2-mod_ssl-2.0.50-4.1.101mdk
apache2-common-2.0.50-7.2.101mdk
apache2-2.0.50-7.2.101mdk
apache2-mod_php-2.0.50_4.3.8-2mdk
apache2-mod_disk_cache-2.0.50-7.2.101mdk
apache2-mod_perl-2.0.50_1.99_16-1mdk
apache-conf-2.0.50-4mdk
apache2-manual-2.0.50-7.2.101mdk
apache2-mod_proxy-2.0.50-7.2.101mdk
openssl-0.9.7d-1.1.101mdk
libopenssl0.9.7d-1.1.101mdk

apache2_2.0.52-1_i386.deb
apache2-common_2.0.52-1_i386.deb
apache2-doc_2.0.52-1_all.deb
apache2-mpm-prefork_2.0.52-1_i386.deb
libapache2-mod-php4_4.3.8-12_i386.deb
libapache2-mod-perl2_1.99.14-4_i386.deb
libapache2-request-perl_2.03-dev-3_i386.deb
openssl_0.9.7d-5_i386.deb








La configuration d'Apache2 avec plusieurs hôtes virtuels, écoutants sur différents ports sécurisés ou normaux, nécessite le lancement d'un daemon apache2 par ports (80 et 443).
Pour ce faire nous allons créer 2 fichiers de configurations qui appelleront chacun leurs modules et leurs fichiers d'hôtes virtuels.
Pour le reste de la configuration, les fichiers par défaut seront utilisés.

Configuration Apache2

Image1

Image2

Dupliquez le fichier
/etc/httpd/conf/httpd2.conf vers
/etc/httpd/conf/httpd2-ssl.conf

Dupliquez le fichier
/etc/httpd/conf/vhosts/Vhosts.conf vers
/etc/httpd/conf/vhosts/Vhosts-ssl.conf

Créez les 2 répertoires suivants :
/etc/httpd/conf.d-http
/etc/httpd/conf.d-https
Ils serviront à charger les modules voulus.

Faites des liens symboliques depuis
/etc/httpd/conf.d/ vers les 2 répertoires créés précédament :
[root@srv8 user]# ln -s /etc/httpd/conf.d/*
/etc/httpd/conf.d-http/

puis supprimez les modules que vous ne souhaitez pas charger pour vos hôtes virtuels HTTP ainsi que les modules SSL.

[root@srv8 user]# ln -s /etc/httpd/conf.d/*
/etc/httpd/conf.d-https/

même principe pour vos hôtes virtuels HTTPS mais conservez les modules SSL.

Créez le répertoire /etc/httpd/ssl qui contiendra par la suite les certificats SSL.

Dupliquez le fichier
/etc/apache2/apache2.conf vers
/etc/apache2/apache2-ssl.conf

Dupliquez le fichier
/etc/apache2/ports.conf vers
/etc/apache2/ports-https.conf

Créez les 2 répertoires suivants :
/etc/apache2/mods-enabled-ssl
/etc/apache2/sites-enabled-ssl
Ils serviront à charger les modules et
hôtes virtuels voulus.

Faites des liens symboliques des modules que vous souhaitez charger pour vos hôtes virtuels HTTP depuis
/etc/apache2/mods-available/ vers le répertoire /etc/apache2/mods-enabled/
et pour vos hôtes virtuels HTTPS vers
/etc/apache2/mods-enabled-ssl/

Placez tous vos fichiers d'hôtes virtuels dans le répertoire /etc/apache2/sites-available
Puis faites des liens symboliques de vos fichiers hôtes virtuels HTTP et default vers
/etc/apache2/sites-enabled
Même principe pour vos hôtes virtuels HTTPS et default mais vers /etc/apache2/sites-enabled-ssl



Image3

Editez le fichier /etc/httpd/conf/httpd2.conf :

### Main Configuration Section
###
# Racine des fichiers de configuration d'Apache2.
ServerRoot /etc/httpd/2.0
PidFile /var/run/httpd.pid
ErrorLog logs/error_log
LogLevel warn
# Racine des fichiers Web par défaut.
DocumentRoot /var/www/html

### Dynamic Shared Object (DSO) Support
###
### You should always leave those three, as they are needed for
### normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)

LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
...
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

###
### Global Configuration
###
# We now support multiple apache configurations on the same server. In
# common.conf, we put all directives that are common to all
# implementations
(httpd, httpd-perl, etc.)
# Apache2 (HTTP) chargera les modules contenus dans ce répertoire.
Include /etc/httpd/conf.d-http/*.conf
Include conf/commonhttpd.conf

###
### Log configuration Section
###

<IfModule mod_log_config.c>
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/Vhost.conf, we use this entry
CustomLog "|/usr/sbin/advxsplitlogfile" vhost env=VLOG
</IfModule>

###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
# Fichier des Virtual hosts HTTP.
Include conf/vhosts/Vhosts.conf
#Include conf/vhosts/DynamicVhosts.conf
#Include conf/vhosts/VirtualHomePages.conf

###
### Performance settings Section
###
#
# 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 On

#
# 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

# prefork MPM [THIS IS THE DEFAULT]
# 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 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

# 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
</IfModule>

# 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 process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
</IfModule>



Image4

Editez le fichier /etc/httpd/conf/httpd2-ssl.conf :

### Main Configuration Section
###
ServerRoot /etc/httpd/2.0
# PidFile différent pour le daemon Apache2 dédié à HTTPS.

PidFile /var/run/httpdssl.pid
# Logs réservés HTTPS.
ErrorLog logs/errorssl_log
LogLevel warn
DocumentRoot /var/www/html

### Dynamic Shared Object (DSO) Support
###
### You should always leave those three, as they are needed for
### normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)

LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
...
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

###
### Global Configuration
###
# We now support multiple apache configurations on the same server. In
# common.conf, we put all directives that are common to all
# implementations
(httpd, httpd-perl, etc.)
# Apache2 (HTTPS) chargera les modules contenus dans ce répertoire.
Include /etc/httpd/conf.d-https/*.conf
Include conf/commonhttpd.conf

###
### IP Address/Port and Proxied configuration section
###
# The APACHEPROXIED setting can be set in /etc/rc.d/init.d/httpd if you
# are using a proxy or accelerator, like the Apache-SGI or khttpd, so ...
# Commentez pour ne pas avoir de conflits de ports (80/443).
BindAddress *
<IfDefine APACHEPROXIED>
Listen 8080
</IfDefine>
#<IfDefine !APACHEPROXIED>
# Listen 80
#</IfDefine>

###
### Log configuration Section
###

<IfModule mod_log_config.c>
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/Vhost.conf, we use this entry
CustomLog "|/usr/sbin/advxsplitlogfile" vhost env=VLOG
</IfModule>

###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
# Fichier des Virtual hosts HTTPS.
Include conf/vhosts/Vhosts-ssl.conf
#Include conf/vhosts/DynamicVhosts.conf
#Include conf/vhosts/VirtualHomePages.conf

###
### Performance settings Section
###
#
# 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 On

#
# 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

# prefork MPM [THIS IS THE DEFAULT]
# 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 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

# 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
</IfModule>

# 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 process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
</IfModule>



Image9

Editez le fichier /etc/httpd/conf/commonhttpd.conf :

### Common server configuration
#
# Apache2 fonctionnera sous l'identité suivante.
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.
#
ServerAdmin webmaster@alex.fr

#Restricted set of options
<Directory />
Options -All -Multiviews
AllowOverride None
<IfModule mod_access.c>
Order deny,allow
Deny from all
</IfModule>
</Directory>

AccessFileName .htaccess

# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<IfModule mod_access.c>
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
</IfModule>

#CacheNegotiatedDocs

#
# UseCanonicalName: With this setting turned on, whenever
# Apache needs to construct a self-referencing URL (a URL that refers back
# to the server the response is coming from) it will use ServerName and
# Port to form a "canonical" name. With this setting off, Apache will
# use the hostname:port that the client supplied, when possible. This
# also affects SERVER_NAME and SERVER_PORT in CGI scripts.
#
UseCanonicalName On

#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
<IfModule mod_mime.c>
TypesConfig conf/apache-mime.types
</IfModule>

#
# DefaultType is 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 mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# EnableMMAP off

# EnableSendfile off

# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
<IfModule mod_log_config.c>
LogFormat "%"h %"l %"u %"t \"%"r\" %">s %"b \"%"{Referer}i\" \"%"{User-Agent}i\"" combined
LogFormat "%"h %"l %"u %"t \"%"r\" %">s %"b" common
LogFormat "%"{Referer}i -> %"U" referer
LogFormat "%"{User-agent}i" agent
LogFormat "%"v %"h %"l %"u %"t \"%"r\" %">s %"b %"T" script
LogFormat "%"v %"h %"l %"u %"t \"%"r\" %">s %"b \"%"{Referer}i\" \"%"{User-Agent}i\" VLOG=%"{VLOG}e" vhost

<IfModule mod_logio.c>
# You need to enable mod_logio.c to use %"I and %"O
#LogFormat "%"h %"l %"u %"t \"%"r\" %">s %"b \"%"{Referer}i\" \"%"{User-Agent}i\" %"I %"O" combinedio
</IfModule>


#
# The location and format of the access logfile (Common Logfile Format).
#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

#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.

#
#CustomLog logs/access_log combined
</IfModule>

#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of: Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens Prod

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (error documents, FTP directory listings,
# mod_status and mod_info output etc., but not CGI generated documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | Email
#
ServerSignature On

#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
<IfModule mod_alias.c>

#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/"..
#
Alias /icons/ /var/www/icons/
Alias /doc /usr/share/doc

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname 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/ /var/www/cgi-bin/
ScriptAlias /protected-cgi-bin/ /var/www/protected-cgi-bin/

<IfModule mod_perl.c>
#Provide two aliases to the same cgi-bin directory,
#to see the effects of the 2 different mod_perl modes
#for Apache::Registry Mode
Alias /perl/ /var/www/perl/
#for Apache::Perlrun Mode
Alias /cgi-perl/ /var/www/perl/
</IfModule>

</IfModule>
# End of aliases.

#
# Redirect allows you to tell clients about documents which used to exist in
# your server's namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
# Format: Redirect old-URI new-URL
#

#
# Directives controlling the display of server-generated directory listings.
#
<IfModule mod_autoindex.c>

#
# FancyIndexing is whether you want fancy directory indexing or standard
#
<IfDefine !APACHE2>
IndexOptions FancyIndexing NameWidth=*
</IfDefine>
<IfDefine APACHE2>
IndexOptions FancyIndexing VersionSort NameWidth=*
</IfDefine>

#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions. These are only displayed for
# FancyIndexed directories.
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
...
AddIcon /icons/blank.png ^^BLANKICON^^

#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
#
DefaultIcon /icons/unknown.png

ReadmeName README.html
HeaderName HEADER.html

#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing. Shell-style wildcarding is permitted.
#
IndexIgnore .??* *~ *# HEADER* RCS CVS *,v *,t

</IfModule>
# End of indexing directives.

#
# Document types.
#
<IfModule mod_mime.c>

#
# AddEncoding allows you to have certain browsers (Mosaic/X 2.1+) uncompress
# information on the fly. Note: Not all browsers support this.
#
AddEncoding x-compress Z

AddEncoding x-gzip gz tgz
AddLanguage ca .ca
...
AddLanguage eo .eo

#AddDefaultCharset ISO-8859-1
# JMD 2003/09/15 Change to off, since it overrides the META tags
AddDefaultCharset Off

# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change this.
#
<IfModule mod_negotiation.c>
LanguagePriority fr en cs de es it da nl
# ForceLanguagePriority Prefer Fallback
</IfModule>

AddCharset ISO-8859-1 .iso8859-1 .latin1
...
AddType application/x-tar .tgz
AddType image/x-icon .ico

#
# If you want to use server side includes, or CGI outside
# ScriptAliased directories, uncomment the following lines.
# To use CGI scripts:
#
AddHandler cgi-script .cgi

#
# For type maps (negotiated resources):
# (This is enabled by default to allow the Apache "It Worked" page
# to be distributed in multiple languages.)
#
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
<IfDefine APACHE2>
AddOutputFilter INCLUDES .shtml
</IfDefine>
<IfDefine !APACHE2>
AddHandler server-parsed .shtml
</IfDefine>

</IfModule>
# End of document types

<Location /manual>
Options Multiviews
ErrorDocument 404 "The document you requested has not been installed on your system. Please install either apache-manual or apache2-manual RPMs.
</Location>

<Location /manual-2.0>
Options Multiviews
ErrorDocument 404 "The document you requested has not been installed on your system. Please install the apache2-manual package.
</Location>
<Location /manual-1.3>
Options Multiviews
ErrorDocument 404 "The document you requested has not been installed on your system. Please install the apache-manual package.
</Location>

#
# Customize behaviour based on the browser
#
<IfModule mod_setenvif.c>

#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash. This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
#

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carfully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully

</IfModule>
# End of browser customization directives

#
# Allow server status reports, with the URL of http://servername/server-status

# Change the ".your_domain.com" to match your domain to enable.
#

<IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
<IfModule mod_access.c>
Order deny,allow
Deny from all
allow from 127.0.0.1
#Allow from .your_domain.com
</IfModule>
</Location>

#
# 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
</IfModule>

#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".your_domain.com" to match your domain to enable.
#
<IfModule mod_info.c>
<Location /server-info>
SetHandler server-info
<IfModule mod_access.c>
Order deny,allow
Deny from all
allow from 127.0.0.1
# Allow from .your_domain.com
</IfModule>
</Location>
</IfModule>

<IfModule mod_perl.c>
<Location /perl-status>
SetHandler perl-script
<IfDefine !APACHE2>
PerlHandler Apache::Status
</IfDefine>
<IfDefine APACHE2>
PerlResponseHandler Apache::Status
</IfDefine>
<IfModule mod_access.c>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</IfModule>
</Location>
</IfModule>

#
# There have been reports of people trying to abuse an old bug from pre-1.1
# days. This bug involved a CGI script distributed as a part of Apache.
# By uncommenting these lines you can redirect these attacks to a logging

# script on phf.apache.org. Or, you can record them yourself, using the script
# support/phf_abuse_log.cgi.
#
#<Location /cgi-bin/phf*>
# Deny from all
# ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi
#</Location>

<IfModule mod_include.c>
# XBitHack on
</IfModule>

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory /var/www/html>

#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "SymLinksifOwnerMatch", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options -Indexes FollowSymLinks MultiViews

#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>

<Directory /var/www/perl>
AllowOverride All
Options -Indexes FollowSymLinks MultiViews ExecCGI
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>

<IfModule mod_cgid.c>
#
# Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>
# for setting UNIX socket for communicating with cgid.
#
#Scriptsock /cgisock
</IfModule>

<Directory /var/www/cgi-bin>
AllowOverride All
Options ExecCGI
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>

<Directory /var/www/protected-cgi-bin>
AllowOverride All
Options ExecCGI
<IfModule mod_access.c>
Order deny,allow
Deny from all
Allow from 127.0.0.1
#allow from .your_domain.com
</IfModule>
</Directory>

#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory /home/*/public_html>
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# <Limit GET POST OPTIONS PROPFIND>
# Order allow,deny
# Allow from all
# </Limit>
# <LimitExcept GET POST OPTIONS PROPFIND>
# Order deny,allow
# Deny from all
# </LimitExcept>
#</Directory>

# These settings are pretty flexible, and allow for Frontpage and XSSI
<Directory /home/*/public_html>
AllowOverride All
Options MultiViews -Indexes Includes FollowSymLinks
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>

<Directory /home/*/public_html/cgi-bin>
Options +ExecCGI -Includes -Indexes
SetHandler cgi-script
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>

<IfModule mod_perl.c>
<Directory /home/*/public_html/perl>
SetHandler perl-script
<IfDefine !APACHE2>
PerlHandler Apache::PerlRun
</IfDefine>
<IfDefine APACHE2>
PerlResponseHandler ModPerl::PerlRun
</IfDefine>
Options -Indexes ExecCGI
PerlSendHeader On
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
</IfModule>

<Directory /var/www/icons>
Options -Indexes MultiViews
AllowOverride None
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>

<Directory /usr/share/doc>
Options Indexes FollowSymLinks
<IfModule mod_access.c>
Order deny,allow
Deny from all
Allow from 127.0.0.1
#allow from .your_domain.com
</IfModule>
</Directory>

<Directory /var/www/html/addon-modules>
Options Indexes FollowSymLinks
</Directory>

<Location /index.shtml>
Options +Includes
</Location>

<IfModule mod_perl.c>
<IfDefine !APACHE2>
PerlModule Apache::Registry
</IfDefine>

#set Apache::Registry Mode for /perl Alias
<Location /perl/*.pl>
SetHandler perl-script
<IfDefine !APACHE2>
PerlHandler Apache::Registry
</IfDefine>
<IfDefine APACHE2>
PerlResponseHandler ModPerl::Registry
</IfDefine>
Options -Indexes ExecCGI
PerlSendHeader On
</Location>

#set Apache::PerlRun Mode for /cgi-perl Alias
<Location /cgi-perl/*.pl>
SetHandler perl-script
<IfDefine !APACHE2>
PerlHandler Apache::PerlRun
</IfDefine>
<IfDefine APACHE2>
PerlResponseHandler ModPerl::PerlRun
</IfDefine>
Options -Indexes ExecCGI
PerlSendHeader On
</Location>
</IfModule>



Image11

Editez le fichier /etc/apache2/apache2.conf :


# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
ServerRoot "/etc/apache2"

# The LockFile directive sets the path to the lockfile used when Apache
# is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
# USE_FLOCK_SERIALIZED_ACCEPT.
#
LockFile /var/lock/apache2/accept.lock

# PidFile: The file in which the server should record its process
# identification number when it starts.

PidFile /var/run/apache2.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 On

# 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 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 20
MaxRequestsPerChild 0
</IfModule>

# pthread MPM
# StartServers ......... initial number of server processes to start
# MaxClients ....... maximum number of server processes allowed to start
# 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 proces
# MaxRequestsPerChild:maximum number of requests a server process serves
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

# 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 process
# MaxRequestsPerChild .. maximum number of connections per server process (then it dies)
<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
AcceptMutex fcntl
</IfModule>

User www-data
Group www-data

LogFormat "%"h %"l %"u %"t \"%"r\" %">s %"b \"%"{Referer}i\" \"%"{User-Agent}i\"" combined
LogFormat "%"h %"l %"u %"t \"%"r\" %">s %"b" common
LogFormat "%"{Referer}i -> %"U" referer
LogFormat "%"{User-agent}i" agent

# Global error log.
# Logs réservés HTTP.
ErrorLog /var/log/apache2/error.log

# Apache2 (HTTP) chargera les modules contenus dans ce répertoire.
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Apache2 (HTTP) écoutera le port contenu dans ce fichier.
Include /etc/apache2/ports.conf

# Include generic snippets of statements
Include /etc/apache2/conf.d/[^.#]*

#Let's have some Icons, shall we?
Alias /icons/ "/usr/share/apache2/icons/"
<Directory "/usr/share/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<IfModule mod_negotiation.c>
<IfModule mod_include.c>
Alias /error/ "/usr/share/apache2/error/"

<Directory "/usr/share/apache2/error">
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority fr
en es de
ForceLanguagePriority Prefer Fallback
</Directory>
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
...
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
</IfModule>
</IfModule>

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.shtml

# UserDir is now a module
UserDir public_html
UserDir disabled root

<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>

AccessFileName .htaccess

<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

UseCanonicalName Off

TypesConfig /etc/mime.types
DefaultType text/plain

HostnameLookups Off

IndexOptions FancyIndexing VersionSort

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
...
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif

ReadmeName README.html
HeaderName HEADER.html

IndexIgnore .??* *~ *# HEADER* RCS CVS *,t

AddEncoding x-compress Z
AddEncoding x-gzip gz tgz

AddLanguage da .dk
...
AddLanguage zh-tw .tw

LanguagePriority fr en da nl et de el it ja ko no pl pt pt-br ltz ca es

AddCharset ISO-8859-1 .iso8859-1 .latin1
...
AddType application/x-tar .tgz

# To use CGI scripts outside /cgi-bin/:
#
#AddHandler cgi-script .cgi .pl

# To use server-parsed HTML files
#
<FilesMatch "\.shtml(\..+)?$">
SetOutputFilter INCLUDES
</FilesMatch>

# If you wish to use server-parsed imagemap files, use
#
#AddHandler imap-file map

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully

# Allow server status reports, with the URL of http://servername/server-status
# Change the ".your_domain.com" to match your domain to enable.
#
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>

# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".your_domain.com" to match your domain to enable.
#
#<Location /server-info>
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
#</Location>

# Chargera les fichiers des Virtual hosts HTTP contenus dans de répertoire.
Include /etc/apache2/sites-enabled/[^.#]*



Image12

Editez le fichier /etc/apache2/apache2ssl.conf :

# ServerRoot: The top of the directory
tree under which the server's
# configuration, error, and log files are kept.
#
ServerRoot "/etc/apache2"

# The LockFile directive sets the path to the lockfile used when Apache
# is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
# USE_FLOCK_SERIALIZED_ACCEPT.
#
LockFile /var/lock/apache2/acceptssl.lock

# PidFile: The file in which the server should record its process
# identification number when it starts.
# PidFile différent pour le daemon Apache2 dédié à HTTPS.

PidFile /var/run/apache2ssl.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 On

# 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 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 20
MaxRequestsPerChild 0
</IfModule>

# pthread MPM
# StartServers ......... initial number of server processes to start
# MaxClients ....... maximum number of server processes allowed to start
# 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 proces
# MaxRequestsPerChild:maximum number of requests a server process serves
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

# 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 process
# MaxRequestsPerChild .. maximum number of connections per server process (then it dies)
<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
AcceptMutex fcntl
</IfModule>

User www-data
Group www-data

LogFormat "%"h %"l %"u %"t \"%"r\" %">s %"b \"%"{Referer}i\" \"%"{User-Agent}i\"" combined
LogFormat "%"h %"l %"u %"t \"%"r\" %">s %"b" common
LogFormat "%"{Referer}i -> %"U" referer
LogFormat "%"{User-agent}i" agent

# Logs réservés HTTPS.
ErrorLog /var/log/apache2/error-ssl.log

# Apache2 (HTTPS) chargera les modules contenus dans ce répertoire.
Include /etc/apache2/mods-enabled-ssl/*.load
Include /etc/apache2/mods-enabled
-ssl/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Apache2 (HTTPS) écoutera le port contenu dans ce fichier.
Include /etc/apache2/ports
-https.conf

# Include generic snippets of statements
Include /etc/apache2/conf.d/[^.#]*

#Let's have some Icons, shall we?
Alias /icons/ "/usr/share/apache2/icons/"
<Directory "/usr/share/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<IfModule mod_negotiation.c>
<IfModule mod_include.c>
Alias /error/ "/usr/share/apache2/error/"

<Directory "/usr/share/apache2/error">
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority fr
en es de
ForceLanguagePriority Prefer Fallback
</Directory>
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
...
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
</IfModule>
</IfModule>

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.shtml

# UserDir is now a module
UserDir public_html
UserDir disabled root

<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>

AccessFileName .htaccess

<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

UseCanonicalName Off

TypesConfig /etc/mime.types
DefaultType text/plain

HostnameLookups Off

IndexOptions FancyIndexing VersionSort

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
...
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif

ReadmeName README.html
HeaderName HEADER.html

IndexIgnore .??* *~ *# HEADER* RCS CVS *,t

AddEncoding x-compress Z
AddEncoding x-gzip gz tgz

AddLanguage da .dk
...
AddLanguage zh-tw .tw

LanguagePriority fr en da nl et de el it ja ko no pl pt pt-br ltz ca es

AddCharset ISO-8859-1 .iso8859-1 .latin1
...
AddType application/x-tar .tgz

# To use CGI scripts outside /cgi-bin/:
#
#AddHandler cgi-script .cgi .pl

# To use server-parsed HTML files
#
<FilesMatch "\.shtml(\..+)?$">
SetOutputFilter INCLUDES
</FilesMatch>

# If you wish to use server-parsed imagemap files, use
#
#AddHandler imap-file map

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully

# Allow server status reports, with the URL of http://servername/server-status
# Change the ".your_domain.com" to match your domain to enable.
#

<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>

# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".your_domain.com" to match your domain to enable.
#
#<Location /server-info>
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
#</Location>

# Chargera les fichiers des Virtual hosts HTTPS contenus dans de répertoire.
Include /etc/apache2/sites-enabled
-ssl/[^.#]*



Image13

Contenu du fichier /etc/apache2/ports.conf :
Listen 80

Contenu du fichier
/etc/apache2/ports-https.conf :
Listen 443


Modifiez le fichier
/etc/apache2/sites-available/default en commentant la redirection par défaut :

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost


DocumentRoot /var/www
<Directory />
     Options FollowSymLinks
     AllowOverride None
</Directory>
<Directory /var/www/>
     Options Indexes FollowSymLinks MultiViews
     AllowOverride None
     Order allow,deny
     allow from all
     # This directive allows us to have apache2's default start page
     # in /apache2-default/, but still have / go to the right place
     #RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
     AllowOverride None
     Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
     Order allow,deny
     Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /icons/ "/usr/share/apache2/icons/"
<Directory "/usr/share/apache2/icons">
     Options Indexes MultiViews
     AllowOverride None
     Order allow,deny
     Allow from all
</Directory>

     Alias /doc/ "/usr/share/doc/"
     RedirectMatch ^/doc/apache2-doc/manual(.*)$ /manual$1
<Directory "/usr/share/doc/">
     Options Indexes MultiViews FollowSymLinks
     AllowOverride None
     Order deny,allow
     Deny from all
     Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>



Création des certificats SSL

Image10

Image14

Déplacez vous dans le répertoire /etc/httpd/ssl

Déplacez vous dans le répertoire /etc/apache2/ssl


Générez votre clef privée sous forme cryptée pour plus de sécurité.
Un mot de passe vous est demandé lors de la création de la clef, il faudra le saisir à chaque lancement du serveur apache2 en mode HTTPS.

[root@srv8 ssl]# openssl genrsa -des3 1024 > alex.key
Generating RSA private key, 1024 bit long modulus
............++++++............++++++
e is 65537 (0x10001)
Enter pass phrase:
Verifying - Enter pass phrase:
[root@srv8
ssl]#

Générez votre clef publique que vous ferez certifier par une autorité de certification comme Thawte, Verisign, ... pour que tous les navigateurs la reconnaissent comme valide.
Sinon auto-signez votre certificat.

[root@srv8
ssl]# openssl req -new -key alex.key -out alex.csr
Enter pass phrase for alex.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:FR
State or Province Name (full name) [Some-State]:Haute-Savoie
Locality Name (eg, city) []:Alex
Organization Name (eg, company) [Internet Widgits Pty Ltd]:alex.fr
Organizational Unit Name (eg, section) []:
Common Name (Indiquez votre hostname) []:srv8.alex.fr
Email Address []:webmaster@alex.fr
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[root@srv8 ssl]#

Pour auto-signé un Certificat :
[root@srv8 ssl]# openssl req -x509 -key alex.key -in alex.csr -out alex.crt
Enter pass phrase for alex.key:
[root@srv8 ssl]#



Image15

Editez le fichier /etc/httpd/conf/vhosts/Vhosts.conf :

################# Exemple ################

#<VirtualHost 111.222.33.44>
#User jmdault
#Group jmdault
#DocumentRoot /home/jmdault/public_html
#ServerName test2.com
#Setenv VLOG /home/jmdault/logs
#ErrorLogs /home/jmdault/test2-error_log
#RewriteEngine On
#RewriteOptions inherit
#</VirtualHost>

NameVirtualHost 192.168.1.1

# Il faut qu'un DNS et Apache2 puissent résoudre l'adresse www.alex.fr
<VirtualHost www.alex.fr>
ServerAdmin webmaster@alex.fr # Adresse mail du responsable.
DocumentRoot /var/www/html # Chemin vers la racine pour ce site.
ServerName www.alex.fr # Nom de ce serveur virtuel.
ErrorLog logs/www.alex.fr-error_log
ServerAlias localhost # Alias de ce serveur virtuel.
 
<Directory /var/www/html/> # Directives pour ce répertoire.
   
Options MultiViews # Autorise l'affichage multilingue.
   
AllowOverride All # Active la lecture des .htaccess
 
</Directory>
 <Directory /var/www/html/files/> # Directives pour ce répertoire.
   
Options Indexes # Autorise de lister le répertoire.
   
AllowOverride None # Déactive la lecture des .htaccess
   
Order allow,deny
   allow from all
 </Directory>
   # Alias de /cgi-bin/ vers /var/www/cgi-bin/
   
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
 <Directory "/var/www/cgi-bin"> # Directives pour ce répertoire.
   
AllowOverride None
   # Autorise l'exécution de CGI,
   # pas d'affichage multilingue et
   # permet de suivre les liens seulement si l'UID du fichier/répertoire
   # sur lequel le lien pointe correspond au même UID.
   
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Order allow,deny
   Allow from all
 </Directory>
</VirtualHost>

<VirtualHost imp.alex.fr>
ServerAdmin webmail@alex.fr
DocumentRoot /var/www/html/webmail
ServerName imp.alex.fr
ErrorLog logs/imp.alex.fr-error_log
</VirtualHost>



Image16

Editez le fichier /etc/httpd/conf/vhosts/Vhosts-ssl.conf :

NameVirtualHost 192.168.1.1:443


<VirtualHost bisness.alex.fr:443>
ServerAdmin webmaster@alex.fr
DocumentRoot /var/www/html/bisness
ServerName bisness.alex.fr
ErrorLog logs/bisness.alex.fr-error_log

# Active SSL.
SSLEngine on
# Chemin vers le certificat SSL.
SSLCertificateFile /etc/httpd/ssl/alex.crt
# Chemin vers votre clef privée SSL.
SSLCertificateKeyFile /etc/httpd/ssl/alex.key

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
 <Directory "/var/www/cgi-bin">
   AllowOverride None
   Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Order allow,deny
   Allow from all
 </Directory>
</VirtualHost>

<VirtualHost secure.alex.fr:443>
ServerAdmin webmaster@alex.fr
DocumentRoot /var/www/html/secure
ServerName secure.alex.fr
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/alex.crt
SSLCertificateKeyFile /etc/httpd/ssl/alex.key
</VirtualHost>



Image18

Editez un fichier d'hôte virtuel HTTP dans /etc/apache2/sites-available/ :

NameVirtualHost 192.168.1.1


# Il faut qu'un DNS et Apache2 puissent résoudre l'adresse www.alex.fr
<VirtualHost www.alex.fr>
ServerAdmin webmaster@alex.fr # Adresse mail du responsable.
DocumentRoot /var/www # Chemin vers la racine pour ce site.
ServerName www.alex.fr # Nom de ce serveur virtuel.
ErrorLog /var/log/apache2/www.alex.fr-error_log
ServerAlias localhost # Alias de ce serveur virtuel.
 
<Directory /var/www/> # Directives pour ce répertoire.
   
Options MultiViews # Autorise l'affichage multilingue.
   
AllowOverride All # Active la lecture des .htaccess
 
</Directory>
 <Directory /var/www/files/> # Directives pour ce répertoire.
   
Options Indexes # Autorise de lister le répertoire.
   
AllowOverride None # Déactive la lecture des .htaccess
   
Order allow,deny
   allow from all
 </Directory>
   # Alias de /cgi-bin/ vers /usr/lib/cgi-bin/
   
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 <Directory "/usr/lib/cgi-bin"> # Directives pour ce répertoire.
   
AllowOverride None
   # Autorise l'exécution de CGI,
   # pas d'affichage multilingue et
   # permet de suivre les liens seulement si l'UID du fichier/répertoire
   # sur lequel le lien pointe correspond au même UID.
   
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Order allow,deny
   Allow from all
 </Directory>
</VirtualHost>

<VirtualHost imp.alex.fr>
ServerAdmin webmail@alex.fr
DocumentRoot /var/www/webmail
ServerName imp.alex.fr
ErrorLog /var/log/apache2/imp.alex.fr-error_log
</VirtualHost>

Faites ensuite un lien symbolique de ce (ou ces) fichier(s) vers
/etc/apache2/sites-enabled/



Image19

Editez un fichier d'hôte virtuel HTTPS dans /etc/apache2/sites-available/ :

NameVirtualHost 192.168.1.1:443

<VirtualHost bisness.alex.fr:443>
ServerAdmin webmaster@alex.fr
DocumentRoot /var/www/bisness
ServerName bisness.alex.fr
ErrorLog /var/log/apache2/bisness.alex.fr-error_log

# Active SSL.
SSLEngine on
# Chemin vers le certificat SSL.
SSLCertificateFile /etc/apache2/ssl/alex.crt
# Chemin vers votre clef privée SSL.
SSLCertificateKeyFile /etc/apache2/ssl/alex.key

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 <Directory "/usr/lib/cgi-bin">
   AllowOverride None
   Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Order allow,deny
   Allow from all
 </Directory>
</VirtualHost>

<VirtualHost secure.alex.fr:443>
ServerAdmin webmaster@alex.fr
DocumentRoot /var/www/secure
ServerName secure.alex.fr
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/alex.crt
SSLCertificateKeyFile /etc/apache2/ssl/alex.key
</VirtualHost>

Faites ensuite un lien symbolique de ce (ou ces) fichier(s) vers
/etc/apache2/sites-enabled-ssl/



Image7

Image8

Dupliquez le script d'origine (/etc/init.d/httpd vers /etc/init.d/httpd-ssl) et modifiez les valeurs httpd en httpd-ssl :
...
HTTPDPID=/var/run/httpd.pid
...
HTTPDCONF="-f $CONF/httpd2.conf"
...
touch /var/lock/subsys/httpd
...
touch /var/lock/subsys/httpd
...
rm -f /var/lock/subsys/httpd

Plus simple voici
les miens.

Démarrez Apache2 (HTTP) en lançant la commande :
[root@srv8 user]# /etc/init.d/httpd start

et Apache2 (HTTPS)
[root@srv8 user]# /etc/init.d/httpd-ssl start
et tapez votre passphrase

Vérification :
[root@srv8 user]# netstat -paute | grep http

Arrêt des daemons :
[root@srv8 user]# killall httpd2

Démarrez Apache2 (HTTP) en lançant la commande :
srv8:/home/user# apache2 -f /etc/apache2/apache2.conf
et Apache2 (HTTPS)

srv8:/home/user# apache2 -f /etc/apache2/apache2ssl.conf
et tapez votre passphrase


Vérification :
srv8:/home/user#
netstat -paute | grep http

Arrêt des daemons :
srv8:/home/user# killall httpd2
























Liens :
http://www.ac-creteil.fr/reseaux/systemes/linux/

http://lea-linux.org/reseau/



Dernière modification : 24/04/05

 

Copyright © 04/02/2004, Arnofear

Contrat Creative Commons Ce document est publié sous licence Creative Commons
Paternité - Pas d'Utilisation Commerciale - Partage des Conditions Initiales à l'Identique :
http://creativecommons.org/licenses/by-nc-sa/3.0/deed.fr