jeudi 16 juin 2011

HTTP - Liste des modules chargés

/usr/local/apache2/bin/httpd -M
Loaded Modules:
 core_module (static)
 authn_file_module (static)
 authn_default_module (static)
 authz_host_module (static)
 authz_groupfile_module (static)
 authz_user_module (static)
 authz_default_module (static)
 auth_basic_module (static)
 include_module (static)
 filter_module (static)
 log_config_module (static)
 env_module (static)
 setenvif_module (static)
 mpm_prefork_module (static)
 http_module (static)
 mime_module (static)
 status_module (static)
 autoindex_module (static)
 asis_module (static)
 cgi_module (static)
 negotiation_module (static)
 dir_module (static)
 actions_module (static)
 userdir_module (static)
 alias_module (static)
 so_module (static)
 php5_module (shared)

HTTP - Liste des VirtualHosts

httpd -t -D DUMP_VHOSTS

VirtualHost configuration:
10.2.15.145:80         is a NameVirtualHost
         default server jtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/jtomcat.re.cdc.fr.conf:4)
         port 80 namevhost jtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/jtomcat.re.cdc.fr.conf:4)
         port 80 namevhost itomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/itomcat.re.cdc.fr.conf:4)
         port 80 namevhost iwebs.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/iwebs.re.cdc.fr.conf:4)
         port 80 namevhost rwebs.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rwebs.re.cdc.fr.conf:4)
         port 80 namevhost rslg.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rslg.re.cdc.fr.conf:4)
         port 80 namevhost rtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rtomcat.re.cdc.fr.conf:4)
         port 80 namevhost ztomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/ztomcat.re.cdc.fr.conf:4)
         port 80 namevhost deidpi-outils.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/deidpi-outils.re.cdc.fr.conf:4)
10.2.15.145:443        is a NameVirtualHost
         default server rtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rtomcat.re.cdc.fr.conf:9)
         port 443 namevhost rtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rtomcat.re.cdc.fr.conf:9)
         port 443 namevhost ztomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/ztomcat.re.cdc.fr.conf:9)
Syntax OK


httpd -S

VirtualHost configuration:
10.2.15.145:80         is a NameVirtualHost
         default server jtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/jtomcat.re.cdc.fr.conf:4)
         port 80 namevhost jtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/jtomcat.re.cdc.fr.conf:4)
         port 80 namevhost itomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/itomcat.re.cdc.fr.conf:4)
         port 80 namevhost iwebs.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/iwebs.re.cdc.fr.conf:4)
         port 80 namevhost rwebs.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rwebs.re.cdc.fr.conf:4)
         port 80 namevhost rslg.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rslg.re.cdc.fr.conf:4)
         port 80 namevhost rtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rtomcat.re.cdc.fr.conf:4)
         port 80 namevhost ztomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/ztomcat.re.cdc.fr.conf:4)
         port 80 namevhost deidpi-outils.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/deidpi-outils.re.cdc.fr.conf:4)
10.2.15.145:443        is a NameVirtualHost
         default server rtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rtomcat.re.cdc.fr.conf:9)
         port 443 namevhost rtomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/rtomcat.re.cdc.fr.conf:9)
         port 443 namevhost ztomcat.re.cdc.fr (/usr/product/apache/httpd-2.2.11/conf/ztomcat.re.cdc.fr.conf:9)
Syntax OK

HTTP - Server Status

Mise en place de la page de Server-status

Configuration au niveau du fichier httpd.conf

LoadModule status_module modules/mod_status.so

<IfModule mod_status.c>
ExtendedStatus On
</IfModule>

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


+ un arrêt/relance

Accès à la page de contrôle:

    http://servername/server-status

ou
    http://servername/server-status?refresh=N avec un rafraichissement de la page toutes les N secondes

Contenu page

Current Time: Wednesday, 17-Mar-2010 15:19:12 CET
Restart Time: Wednesday, 17-Mar-2010 15:16:55 CET
Parent Server Generation: 7
Server uptime: 2 minutes 17 seconds
Total accesses: 4 - Total Traffic: 8 kB
CPU Usage: u0 s0 cu0 cs0
.0292 requests/sec - 59 B/second - 2048 B/request
1 requests currently being processed, 49 idle workers

W_________________________________________________..............
................................................................
................................................................
................................................................
../..
................................................................
................................................................
................................................................
................................................................
................................................................

Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process

Srv    PID    Acc    M    CPU     SS    Req    Conn    Child    Slot    Client    VHost    Request
0-7    18632    1/1/1    W     0.00    0    0    0.0    0.00    0.00     10.2.54.16    iprefon.re.cdc.fr    GET /server-status HTTP/1.1
0-7    18632    0/2/2    _     0.00    35    0    0.0    0.00    0.00     10.2.54.16    iprefon.re.cdc.fr    GET /favicon.ico HTTP/1.1
1-7    18633    0/1/1    _     0.00    103    0    0.0    0.00    0.00     127.0.0.1    rldeva2.re.cdc.fr    GET /server-status HTTP/1.0
Srv    Child Server number - generation
PID    OS process ID
Acc    Number of accesses this connection / this child / this slot
M    Mode of operation
Module    Module active
CPU    CPU usage, number of seconds
SS    Seconds since beginning of most recent request
Req    Milliseconds required to process most recent request
Conn    Kilobytes transferred this connection
Child    Megabytes transferred this child
Slot    Total megabytes transferred this slot
IBM_HTTP_Server Server at rldeva2.re.cdc.fr Port 80

HTTP - Liste des modules

Core Features and Multi-Processing Modules

core
    Core Apache HTTP Server features that are always available
mpm_common
    A collection of directives that are implemented by more than one multi-processing module (MPM)
beos
    This Multi-Processing Module is optimized for BeOS.
event
    An experimental variant of the standard worker MPM
mpm_netware
    Multi-Processing Module implementing an exclusively threaded web server optimized for Novell NetWare
mpmt_os2
    Hybrid multi-process, multi-threaded MPM for OS/2
prefork
    Implements a non-threaded, pre-forking web server
mpm_winnt
    This Multi-Processing Module is optimized for Windows NT.
worker
    Multi-Processing Module implementing a hybrid multi-threaded multi-process web server

Other Modules

mod_actions
    This module provides for executing CGI scripts based on media type or request method.
mod_alias
    Provides for mapping different parts of the host filesystem in the document tree and for URL redirection
mod_asis
    Sends files that contain their own HTTP headers
mod_auth_basic
    Basic authentication
mod_auth_digest
    User authentication using MD5 Digest Authentication.
mod_authn_alias
    Provides the ability to create extended authentication providers based on actual providers
mod_authn_anon
    Allows "anonymous" user access to authenticated areas
mod_authn_dbd
    User authentication using an SQL database
mod_authn_dbm
    User authentication using DBM files
mod_authn_default
    Authentication fallback module
mod_authn_file
    User authentication using text files
mod_authnz_ldap
    Allows an LDAP directory to be used to store the database for HTTP Basic authentication.
mod_authz_dbm
    Group authorization using DBM files
mod_authz_default
    Authorization fallback module
mod_authz_groupfile
    Group authorization using plaintext files
mod_authz_host
    Group authorizations based on host (name or IP address)
mod_authz_owner
    Authorization based on file ownership
mod_authz_user
    User Authorization
mod_autoindex
    Generates directory indexes, automatically, similar to the Unix ls command or the Win32 dir shell command
mod_cache
    Content cache keyed to URIs.
mod_cern_meta
    CERN httpd metafile semantics
mod_cgi
    Execution of CGI scripts
mod_cgid
    Execution of CGI scripts using an external CGI daemon
mod_charset_lite
    Specify character set translation or recoding
mod_dav
    Distributed Authoring and Versioning (WebDAV) functionality
mod_dav_fs
    filesystem provider for mod_dav
mod_dav_lock
    generic locking module for mod_dav
mod_dbd
    Manages SQL database connections
mod_deflate
    Compress content before it is delivered to the client
mod_dir
    Provides for "trailing slash" redirects and serving directory index files
mod_disk_cache
    Content cache storage manager keyed to URIs
mod_dumpio
    Dumps all I/O to error log as desired.
mod_echo
    A simple echo server to illustrate protocol modules
mod_env
    Modifies the environment which is passed to CGI scripts and SSI pages
mod_example
    Illustrates the Apache module API
mod_expires
    Generation of Expires and Cache-Control HTTP headers according to user-specified criteria
mod_ext_filter
    Pass the response body through an external program before delivery to the client
mod_file_cache
    Caches a static list of files in memory
mod_filter
    Context-sensitive smart filter configuration module
mod_headers
    Customization of HTTP request and response headers
mod_ident
    RFC 1413 ident lookups
mod_imagemap
    Server-side imagemap processing
mod_include
    Server-parsed html documents (Server Side Includes)
mod_info
    Provides a comprehensive overview of the server configuration
mod_isapi
    ISAPI Extensions within Apache for Windows
mod_ldap
    LDAP connection pooling and result caching services for use by other LDAP modules
mod_log_config
    Logging of the requests made to the server
mod_log_forensic
    Forensic Logging of the requests made to the server
mod_logio
    Logging of input and output bytes per request
mod_mem_cache
    Content cache keyed to URIs
mod_mime
    Associates the requested filename's extensions with the file's behavior (handlers and filters) and content (mime-type, language, character set and encoding)
mod_mime_magic
    Determines the MIME type of a file by looking at a few bytes of its contents
mod_negotiation
    Provides for content negotiation
mod_nw_ssl
    Enable SSL encryption for NetWare
mod_proxy
    HTTP/1.1 proxy/gateway server
mod_proxy_ajp
    AJP support module for mod_proxy
mod_proxy_balancer
    mod_proxy extension for load balancing
mod_proxy_connect
    mod_proxy extension for CONNECT request handling
mod_proxy_ftp
    FTP support module for mod_proxy
mod_proxy_http
    HTTP support module for mod_proxy
mod_rewrite
    Provides a rule-based rewriting engine to rewrite requested URLs on the fly
mod_setenvif
    Allows the setting of environment variables based on characteristics of the request
mod_so
    Loading of executable code and modules into the server at start-up or restart time
mod_speling
    Attempts to correct mistaken URLs that users might have entered by ignoring capitalization and by allowing up to one misspelling
mod_ssl
    Strong cryptography using the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols
mod_status
    Provides information on server activity and performance
mod_substitute
    Perform search and replace operations on response bodies
mod_suexec
    Allows CGI scripts to run as a specified user and Group
mod_unique_id
    Provides an environment variable with a unique identifier for each request
mod_userdir
    User-specific directories
mod_usertrack
    Clickstream logging of user activity on a site
mod_version
    Version dependent configuration
mod_vhost_alias
    Provides for dynamically configured mass virtual hosting

HTTP - Génération fichier passwd

htpasswd -m ../conf/admin.passwd ihs
New password:
Re-type new password:
Updating password for user ihs



htpasswd -m <fichier_password> <user>
NB : mettre "-c" lors de la première création

HTTP - Alias

Alias /logs/ "/logs/repertoire_voulu/"

<Directory "/logs/repertoire_voulu/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

HTTP - Mode d'installation PHP

Il y a deux moyen d'installer PHP avec apache:

Installation Statique

La manière statique consiste à charger la librairie du moteur PHP dans le noyau Apache.
L'option d'installation est --with-apache

L'installation se déroule de la manière suivante:

Configuration apache
Configuration PHP (--with-apache)
Compilation de PHP --> le make va déposer la librairie statique de PHP dans le moteur apache
Compilation de Apache --> la librairie est intégrée dans la compilation du httpd

Le php est ainsi natif dans le noyau Apache.

Installation Dynamique

(avec Apxs): -enable-module=so 

La manière dynamique consiste à charge la librairie PHP (partagée) à partir du binaire httpd.
Cette partie est gérée par le binaire apxs.

L'installation se déroule de la manière suivante:

Configuration Apache (-enable-module=so) --> dynamique
Compilation de Apache ( La partie PHP n'existe pas à ce stade)
Configuration de PHP (--with-apxs)
Compilation de PHP (génération de la librairie partagée)

Pour que cela fonctionne, il faut ajouter les lignes suivantes dans le fichier httpd.conf:

    AddType application/x-httpd-php .php
    LoadModule php4_module libexec/libphp4.so

Au lancement d'Apache, le noyau apache ira charger la librairie PHP.

NB : nous pouvons supprimer tous les binaires PHP, seule la librairie /etc/http/modules/libphp4.so suffit à interpréter le PHP.