Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

29

Click here to load reader

Transcript of Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

Page 1: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP-Nuke

Fecha Viernes, 29 julio a las 15:21:50Tema CMS, ECM, Gestor de contenidos web

A continuación os mostramos un artículo/manual/ instrucciones sobre cómo instalar y configurar un Servidor Web en Windows con su correspondiente Sitio Web con Apache (Servidor Web), PHP (lenguaje de programación), MySQL (Base de Datos) y PHP-Nuke (Gestor de Contenidos). Todos los componentes son gratuitos.

CÓMO INSTALAR Y CONFIGURAR UN SERVIDOR WEB Y UN SITIO WEB EN WINDOWS CON APACHE, MYSQL, PHP Y PHP-NUKE

Este artículo muestra paso a paso cómo hacer que un equipo con Windows XP (válido para cualquier versión de Windows: 98, ME, XP, 2000, 2003) sea un servidor web con Apache, PHP y MySQL. Y, además os explicamos cómo crear y administrar un Sitio Web con el gestor de contenidos (gratuito) PHP-Nuke (basado en PHP y MySQL):

1. En pirmer lugar descargaremos los ficheros necesarios para la instalción de Apche, para ello podemos acceder AppServ Open Project:

http://www.appservnetwork.compara descargar un paquete completo que en su versión AppServ 2.4.4a Packages

http://prdownloads.sourceforge.net/appserv/appserv-win32-2.4.4a.exe?download

(totalmente gratuito) incluye:

Apache 1.3.33 PHP 4.3.11 MySQL 4.0.24 phpMyAdmin-2.5.7-pl1 MyODBC-3.51.11-2

2. Una vez descargado el fichero, lo ejecutamos y seguimos las instrucción del programa de instalción, nos aparecerá una ventana de Bienvenida, pulsaremos

"Next":

Page 2: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

Ahora especificaremos la ubicación de los ficheros de instalación (no es recomendable instalarlo en la ubicación por defecto pues será el primer sitio donde busque un hacker

que haya accedido a nuestra red):

Seleccionaremos el tipo de instalación (recomendado "Custom" para usuarios avanzados o para especificar los paquetes a instalar):

Marcaremos los componentes que queramos instalar (Apache = Servidor Web, MySQL = Base de Datos, PHP = Lenguaje de programación para la web, incluye acceso a Bases de Datos, phpMyAdmin = Administrador web de base de datos MySQL (utiliza PHP)). Recomendamos instalar todos los paquetes, salvo que ya tenga alguno instalado o desee

instalarlo por separado:

Page 3: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

A continuación especificaremos el nombre del servidor (Server Name), si tenemos registrado un dominio redirecconado a la IP donde estemos instalando el Servidor Web

podremos especificarlo aquí, por ejemplo www.ajpdsoft.com, en caso contrario pondremos "localhost" o la IP del servidor Web, también especificaremos el email del

administrador y el puerto que se utilizará (por defecto y, normalmente, es el 80):

3. Si disponemos de un Router en nuestra red local (LAN) y queremos permitir el acceso externo a nuestro Servidor Web tendremos que abrir y redireccionar

(mapear) el puerto especificado anteriormente en el Router (o cortafuegos). A continuación os mostramos cómo mapear un puerto a una IP local (en este caso

suponemos que la IP de nuestro Servidor Web es 192.168.1.1 y el puerto a mapear será el 80) en varios modelos y marcas de router (obviamente

dependiendo del modelo de Router el NAT estará en diferentes menús):

Router SMC Barracude g: en este router el mapeo de puertos se encuetra en "NAT" - "Virtual Server", especificaremos la IP del Servidor Web en "Private

IP" y el puerto a redireccionar en "Service Port":

Page 4: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

ZyXEL: accederemos a "Advanced setup" - "NAT" - "SUA Only" - "Edit Details":

Otro modelo de ZyXEL: desde "Configuration" - "Security" - "Advanced NAT Configuration" - "Add reserved mapping":

(como se puede observar en casi todos suele ser una opción llamada NAT (Network Address Translation))

4. Volviendo a la instalación de AppServ, tras seleccionar el puerto y mapearlo, pulsaremos en "Next" y especificaremos los datos para configurar MySQL

("User Name": nombre de usuario para acceso a la Base de Datos, "Password":

Page 5: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

contraseña para este usuario, "Charset": juego de caracteres, para idioma español normalmente "latin1"). A continuación pulsaremos "Next":

Por defecto MySQL crea dos usuarios, uno llamado "mysql" (sin contraseña) que sólo tiene acceso de lectura y otro llamado "root" (sin contraseña) que tiene permisos para

administración. Con lo cual es recomendable acceder a MySQL (mediante phpMyAdmin o cualquier otro cliente) y modificar crear una contraseña para el usuario

"root".

El programa de instalación empezará a copiar los ficheros necesarios al disco duro:

En la ventana que aparece a continuación podremos configurar el tipo de inicio de los servicios necesarios para que el Servidor Web (Apache) y el Servidor de Bases de Datos (MySQL), si marcamos la opción "Start Apache" se iniciará el servicio de Apache y si

marcamos "Start MySQL" se inicará el servicio de MySQL. Pulsaremos en "Close" para finalizar la instalación:

Page 6: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

Si no hay problemas nos aparecerá una ventana de MS-DOS indicando que el servicio de Apache está iniciado. Para comprobar que se ha instalado correctamente, abrimos el navegador de Internet y ponemos en dirección "http://localhost", nos debería aparecer

una ventana como esta:

Desde esta ventana podremos ver, por ejemplo datos sobre PHP (versión ...) pulsando en "PHP Information Version 5.0.4" o también podremos administrar MySQL pulsando

"phpMyAdmin Database Manager Versión 2.6.2" o bien poniendo en el navegador "http://localhost/phpMyAdmin":

Page 7: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

El fichero de configuración para phpMyAdmin se encuentra en: "UNIDAD_Y_CARPETA_DE_INSTALACIONwwwphpMyAdmin" y se llama "config.inc.php". Desde aquí podremos establecer, por ejemplo, el usuario y la

contraseña con el que nos conectaremos a MySQL y otros muchos parámetros. Por ejemplo: si ya teníamos instalado MySQL con nuestro usuario y contraseña, para

añadirlos al fichero de configurar y tener acceso desde phpMyAdmin tendremos que modicar los siguientes parámetros (en negrita los datos a modificar):

...

$cfg['Servers'][$i]['controluser'] = 'NOMBREUSUARIO'; // MySQL control user settings// (this user must have read-only

$cfg['Servers'][$i]['controlpass'] = 'CONTRASEÑAUSUARIO'; // access to the "mysql/user"// and "mysql/db" tables).// The controluser is also// used for all relational

// features (pmadb)$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?

$cfg['Servers'][$i]['user'] = 'NOMBREUSUARIO'; // MySQL user$cfg['Servers'][$i]['password'] = 'CONTRASEÑAUSUARIO'; // MySQL password (only needed

// with 'config' auth_type)

...

5. Si ya hemos instalado Apache y hemos mapeado el correspondiente puerto (80) y, en caso de tener cortafuegos, hemos permitido el tráfico para dicho puerto, podremos probar nuestro Servidor Web realizando una conexión externa, para

ello hemos de averiguar la IP pública que tenemos (la que le asigna su proveedor de Internet que no tiene por qué coincidir con la IP local del PC, es

recomendable que esta IP sea fija para un Servidor Web, si no la sabemos podemos obtenerla pulsando aquí. Tras obtenerla nos conectaremos a otro PC de

fuera de nuestra red bien con control remoto o bien saliendo físicamente de nuestra ubicación y, en un PC con conexión a Internet, pondremos en el

navegador web la siguiente dirección "http://IP_PUBLICA_OBTENIDA", nos debería aparecer (si no hay problemas con el cortafuegos y el puerto está correctamente mapeado) la misma ventana que si lo hiciésemos en local.

Page 8: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

En la captura de pantalla que a continuación os mostramos podréis observar que también se puede administrar MySQL remotamente mediante phpMyAdmin a través del

navegador de Internet (sin necesidad de instalar en el PC con el que nos conectamos ningún tipo de software):

(en nuestro caso hemos utilizado Radmin Viewer para acceder remotamente a otro PC externo a nuestra red y probar la conexión a nuestro recién configurado Servidor Web).

Por supuesto, podréis comprobar que tras configurar el fichero "config.inc.php" introduciendo el usuario y la contraseña para el acceso a MySQL, cualquier usuario que

sepa nuestra IP pública podría acceder y administrar MySQL sin introducir usuario y contraseña, para solucionar esto accederemos al fichero "config.inc.php" ubicado en

"UNIDAD_Y_CARPETA_DE_INSTALACIONwwwphpMyAdmin" y modificaremos el parámetro "$cfg['Servers'][$i]['auth_type']", poniendo como valor "http":

$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?$cfg['Servers'][$i]['user'] = ''; // MySQL user

$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed

// with 'config' auth_type)

de esta forma, cada vez que intentemos conectarnos con phpMyAdmin a MySQL nos aparecerá una ventana de petición de usuario y contraseña:

Page 9: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

6. Para configurar Apache (Servidor Web) abriremos el fichero "httpd.conf" que se encuentra en

"UNIDAD_Y_CARPETA_DE_INSTALACION/apache/conf". Los parámetros más importantes de este fichero son:

"DocumentRoot": con este parámetro especificaremos la ruta donde se encuentran los ficheros html, php, etc para nuestro sitio web. Si

queremos que nuestro Servidor Web sirva para alojar un sitio web este parámetro especificará la ubicación de los archivos de nuestro sitio,

incluyendo el index.php ó index.html que será el primero que aparezca. Por defecto, como hemos podido observar que tras poner

"http://localhost" en el navegador aparece una página web con el título "The AppServ Open Project - 2.5.4a for Windows", esta página aparece

porque el programa de instalación copia en la carpeta "...www" el fichero "index.php" que es el que muestra esta ventana y, además, configura por

defecto el parámetro "DocumentRoot" con el valor "UNIDAD_Y_CARPETA_DE_INSTALACION/www", en nuestro

caso:

## 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 "E:/AppServ/www/PHP-Nuke"

Cada vez que se cambie el parámetro "DocumentRoot" también habrá que cambiar el parámetro "" con el mismo valor:

## Note that from this point forward you must specifically allow

# particular features to be enabled - so if something's not working as# you might expect, make sure that you have specifically enabled it

# below.#

## This should be changed to whatever you set DocumentRoot to.

Page 10: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

#

"ServerRoot": este parámetro especifica la ubicación de los ficheros de configuración y ejecución de Apache, por defecto tendrá la misma ruta

que la ruta de instalación, en nuetro caso:

## 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 "E:/AppServ/Apache"

"DirectoryIndex": estos serán los ficheros que admitirá el Servidor Web como ficheros de inicio del Sitio Web. En nuestro caso sólo hemos dejado "index.php"

pues será el que utilizará nuestro Sitio Web como fichero inicial:

## DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.#

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

.

"ErrorLog": especifica la ubicación del fichero de log de errores:

## ErrorLog: The location of the error log file.

# If you do not specify an ErrorLog directive within a # container, error messages relating to that virtual host will be

# logged here. If you *do* define an error logfile for a # container, that host's errors will be logged there and not here.

#ErrorLog logs/error.log

"LogLevel": especifica los tipos de errores que queramos almacenar en el fichero "error.log", los posibles valores son: debug, info, notice, warn, error, crit,

alert, emerg. Hay que tener precaución con este parámetro pues una mala configuración puede originar que el fichero de error "error.log" crezca hasta

ocupar varias gigas de espacio:

## LogLevel: Control the number of messages logged to the error.log.

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

#LogLevel warn

"CustomLog ... common": este parámetro especifica la ubicación y el nombre del fichero donde se guardarán los accesos a nuestro Servidor Web

("access.log"):

## The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a

Page 11: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

# container, they will be logged here. Contrariwise, if you *do*# define per- access logfiles, transactions will be

# logged therein and *not* in this file.#

CustomLog logs/access.log common

"CustomLog ... referer": este parámetro especifica la ubicación y el nombre del fichero donde se guardará la URL que da origen a la visita a nuestro Servidor

Web:

## If you would like to have agent and referer logfiles, uncomment the

# following directives.#

CustomLog logs/referer.log referer

"CustomLog ... agent": este parámetro especifica la ubicación y el nombre del fichero donde se guardarán los tipos diferentes Navegadores Web con los que se

visite nuestro Servidor Web así como el Sistema Operativo:

CustomLog logs/agent.log agent

"CustomLog ... combined": con este parámetro (por defecto comentado con "#") podemos especificar a Apache que queremos los tres log anteriores (common, referer y agent) en el mismo fichero. En nuestro caso tenemos este parámetro

comentado para que guarde cada tipo de dato en un fichero diferente:

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

NOTA IMPORTANTE: cada vez que cambiemos algún parámetro en el fichero "httpd.conf" y queramos que se apliquen los cambios tendremos que detener el servico de Apache y volver a iniciarlo. Para detenerlo es suficiente con cerrar la ventana MS-

DOS que se abre cuando se inicia. Para inciarlo podemos hacerlo accediendo a "...apache" y ejecutando el fichero "apache_start.bat". Una vez reiniciado el servicio

Apache los cambios se habrán aplicado.

7. Si queremos instalar permanentemente el servicio que inicia Apache (para que cuando se reinicie el Servidor se inicie el servicio de Apache automáticamente) podemos hacerlo ejecutando el fichero: "apache_serviceinstall.bat" ubicado en

"...apache". Para desinstalarlo ejecutaremos "apache_serviceuninstall.bat".

8. En nuestro caso, puesto que hemos utilizado Windows XP SP2 y teníamos habilitado el cortafuegos que éste incluye hemos tenido que abrir el puerto 80 en el mismo para que funcionara correctamente nuestro Servidor Web. Para abrirlo

accedemos a "Inicio" - "Configuración" - "Panel de Control" - "Firewall de Windows" - "Pestaña excepciones" - "Agregar puerto", en "Nombre de puerto" ponemos http y en "Número de puerto" ponemos 80 (o el que hayamos elegido

en la instalación), guardamos todo y lo probamos. Con cualquier otro cortafuetos también es necesario abrir el puerto utilizado.

Page 12: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

9. Por último, puesto que estamos interesados en tener un sitio web en nuestro propio Servidor Web, utilizando PHP-Nuke (que se puede descargar

gratuitamente de http://www.download-phpnuke.com/) que es un gestor de contenidos web basado en PHP y MySQL (lo que hemos instalado anteriormente junto con Apache) podremos crear nuestro propio Sitio Web gratuitamente. Una vez descargado el fichero de PHP-Nuke lo descomprimimos y copiamos a la ruta

que hemos configurado en el parámetro "DocumentRoot", en nuestro caso hemos copiado los ficheros de la carpeta de instalación "...html" de PHP-Nuke a la carpeta "E:AppServwwwPHP-Nuke". Puesto que PHP-Nuke es un gestor de contenidos que se basa en MySQL necesita que creemos en MySQL un nuevo esquema (base de datos) y unas tablas. Para ello la instalación de PHP-Nuke

(versión 7) incluye un fichero llamado "...sql uke.sql" que lleva todas las sentencias SQL necesarias para crear las tablas. Para ejecutar este fichero

podemos hacerlo desde phpMyAdmin. Abrimos el fichero, copiamos todo su contenido, iniciamos la sesión en phpMyAdmin (como administradores, usuario

root o alguno que tenga los mismos privilegios), creamos una nueva base de datos (en nuestro caso la llamamos "php-nuke"):

phpMyAdmin abrirá la base de datos creada, a continuación pulsamos en "SQL":

Pegamos el contenido del fichero nuke.sql en el cuadro de texto: "Ejecute la/s consulta/s SQL en la base de datos php-nuke:" y pulsamos en "Continúe" (también podemos

especificar la ubicación del fichero nuke.sql directamente en "Localización del archivo de texto:"):

Page 13: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

Tras ejecutarse las sentencias SQL habrá creado las tablas (92) y registros necesarios para que PHP-Nuke funcione correctamenete:

Por último, para configurar el usuario, la contraseña y el nombre de la Base de Datos abriremos el fichero de PHP-Nuke llamado "config.php" y cambiaremos los siguientes

parámetros:

"$dbhost": ubicación del Servidor Web, por defecto "localhost". "$dbuname": nombre del usuario que deberá tener acceso a las tablas de PHP-

Nuke. "$dbpass": contraseña del usuario que deberá tener acceso a las tablas de PHP-

Nuke. "$dbname": nombre que hemos dado a la base de datos de PHP-Nuke al crearla,

en nuestro caso "php-nuke".

Por fin podremos comprobar el resultado de la instalación de Apache, PHP, MySQL y PHP-Nuke, para ello escribimos en el navegador de Internet "http://localhost" y nos

aparecerá la ventana de configuración de PHP-Nuke:

Page 14: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

Puesto que aún no hemos creado un usuario administrador para configurar y añadir los contenidos con PHP-Nuke a nuestro sitio web, pulsaremos en "Administration" o bien pondremos en el navegador de Internet "http://localhost/admin.php", rellenamos los

datos y pulsamos en "Enviar":

A continuación nos aparecerá una ventana para iniciar la sesión como usuario administrador, rellenamos los datos (con los introducidos anteriormente) y pulsamos en

"Login":

Page 15: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

Con la ventana de administración podremos configurar cualquier aspecto de nuestra web así como añadir cualquier tipo de contenido, esto, obviamente lo dejamos a vuestra

leal saber y entender:

Un ejemplo de web realizada con PHP-Nuke, Apache, MySQL y PHP puede ser la nuestra: AjpdSoft

ANEXO

Ejemplo del contenido del fichero access.log (Apache):

192.168.1.4 - - [29/Jul/2005:18:40:19 +0200] "GET / HTTP/1.1" 200 141192.168.1.4 - - [29/Jul/2005:18:40:19 +0200] "GET /favicon.ico HTTP/1.1" 404 295

192.168.1.4 - - [29/Jul/2005:18:40:21 +0200] "GET / HTTP/1.1" 200 141192.168.1.4 - - [29/Jul/2005:18:40:22 +0200] "GET /favicon.ico HTTP/1.1" 404 295

127.0.0.1 - - [29/Jul/2005:18:40:25 +0200] "GET / HTTP/1.1" 200 15283.58.39.172 - - [29/Jul/2005:18:48:22 +0200] "GET / HTTP/1.1" 200 152

Ejemplo del contenido del fichero agent.log (Apache):

Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.7.6) Gecko/20050720 Firefox/1.0 (Ubuntu package 1.0.2 MFSA2005-56)Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.7.6) Gecko/20050720 Firefox/1.0 (Ubuntu package 1.0.2 MFSA2005-56)Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.7.6) Gecko/20050720 Firefox/1.0 (Ubuntu package 1.0.2 MFSA2005-56)Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.7.6) Gecko/20050720 Firefox/1.0 (Ubuntu package 1.0.2 MFSA2005-56)

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Ejemplo del contenido del fichero referer.log (Apache):

- -> /index.php- -> /favicon.ico- -> /index.php

Page 16: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

- -> /favicon.ico- -> /index.php- -> /index.php

Ejemplo del contenido del fichero httpd.conf (Apache):

## Based upon the NCSA server configuration files originally by Rob McCool.

## This is the main Apache server configuration file. It contains the

# configuration directives that give the server its instructions.# See for detailed information about

# the directives.#

# Do NOT simply read the instructions in here without understanding# what they do. They're here only as hints or reminders. If you are unsure

# consult the online docs. You have been warned. #

# The configuration directives are grouped into three basic sections:# 1. Directives that control the operation of the Apache server process as a

# whole (the 'global environment').# 2. Directives that define the parameters of the 'main' or 'default' server,

# which responds to requests that aren't handled by a virtual host.# These directives also provide default values for the settings

# of all virtual hosts.# 3. Settings for virtual hosts, which allow Web requests to be sent to# different IP addresses or hostnames and have them handled by the

# same Apache server process.#

# Configuration and logfile names: If the filenames you specify for many# of the server's control files begin with "/" (or "drive:/" for Win32), the

# server will use that explicit path. If the filenames do *not* begin# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"

# with ServerRoot set to "C:/Program Files/Apache Group/Apache2" will be interpreted by the# server as "C:/Program Files/Apache Group/Apache2/logs/foo.log".

## NOTE: Where filenames are specified, you must use forward slashes

# instead of backslashes (e.g., "c:/apache" instead of "c:apache").# If a drive letter is omitted, the drive on which Apache.exe is located# will be used by default. It is recommended that you always supply

# an explicit drive letter in absolute paths, however, to avoid# confusion.

#

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

## 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 "E:/AppServ/Apache"

## 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 logs/apache_runtime_status

## PidFile: The file in which the server should record its process

# identification number when it starts.#

PidFile logs/httpd.pid

Page 17: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

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

##

# WinNT MPM# ThreadsPerChild: constant number of worker threads in the server process

# MaxRequestsPerChild: maximum number of requests a server process serves

ThreadsPerChild 250MaxRequestsPerChild 0

## Listen: Allows you to bind Apache to specific IP addresses and/or

# ports, instead of the default. See also the # 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:80Listen 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.soLoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.soLoadModule asis_module modules/mod_asis.soLoadModule 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.soLoadModule autoindex_module modules/mod_autoindex.so

#LoadModule cern_meta_module modules/mod_cern_meta.soLoadModule cgi_module modules/mod_cgi.so

#LoadModule dav_module modules/mod_dav.so#LoadModule dav_fs_module modules/mod_dav_fs.so

LoadModule dir_module modules/mod_dir.soLoadModule env_module modules/mod_env.so

#LoadModule expires_module modules/mod_expires.so#LoadModule file_cache_module modules/mod_file_cache.so

#LoadModule headers_module modules/mod_headers.soLoadModule imap_module modules/mod_imap.so

LoadModule include_module modules/mod_include.so#LoadModule info_module modules/mod_info.soLoadModule isapi_module modules/mod_isapi.so

Page 18: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

LoadModule log_config_module modules/mod_log_config.soLoadModule mime_module modules/mod_mime.so

#LoadModule mime_magic_module modules/mod_mime_magic.so#LoadModule proxy_module modules/mod_proxy.so

#LoadModule proxy_connect_module modules/mod_proxy_connect.so#LoadModule proxy_http_module modules/mod_proxy_http.so#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

LoadModule negotiation_module modules/mod_negotiation.soLoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so#LoadModule speling_module modules/mod_speling.so

#LoadModule status_module modules/mod_status.so#LoadModule unique_id_module modules/mod_unique_id.so

LoadModule userdir_module modules/mod_userdir.so#LoadModule usertrack_module modules/mod_usertrack.so

#LoadModule vhost_alias_module modules/mod_vhost_alias.so#LoadModule ssl_module modules/mod_ssl.so

LoadModule php5_module E:/AppServ/php/php5apache2.dll

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

# definition. These values also provide defaults for# any containers you may define later in the file.

## All of these directives may appear inside containers,

# in which case these default settings will be overridden for the# virtual host being defined.

#

## 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. [email protected]#

#ServerAdmin-AppServ

## 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 www.ajpdsoft.com

## 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 "E:AppServwwwPHP-Nuke"

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

Page 19: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

# features. #

Options FollowSymLinks ExecCGI IndexesAllowOverride None

## Note that from this point forward you must specifically allow

# particular features to be enabled - so if something's not working as# you might expect, make sure that you have specifically enabled it

# below.#

## This should be changed to whatever you set DocumentRoot to.

#

## Possible values for the Options directive are "None", "All",

# or any combination of:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

## Note that "MultiViews" must be named *explicitly* --- "Options All"

# doesn't give it to you.#

# The Options directive is both complicated and important. Please see# http://httpd.apache.org/docs-2.0/mod/core.html#options

# for more information.#

Options Indexes FollowSymLinks MultiViews ExecCGI

## AllowOverride controls what directives may be placed in .htaccess files.

# It can be "All", "None", or any combination of the keywords:# Options FileInfo AuthConfig Limit

#AllowOverride All

## Controls who can get stuff from this server.

#Order allow,deny

Allow from all

## UserDir: The name of the directory that is appended onto a user's home

# directory if a ~user request is received. Be especially careful to use# proper, forward slashes here. On Windows NT, "Personal/My Website"

# is a more appropriate choice.#

UserDir "E:/AppServ/www/users/"

## Control access to UserDir directories. The following is an example

# for a site where these directories are restricted to read-only.#

# You must correct the path for the root to match your system's configured# user directory location, e.g. "C:/WinNT/profiles/*/My Documents/My Website"

# or whichever, as appropriate.##

# AllowOverride FileInfo AuthConfig Limit# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

# # Order allow,deny

# Allow from all# #

# Order deny,allow# Deny from all

# #

## DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.#

Page 20: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

# 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.php index.php3 index.html index.html.var index.htm

## AccessFileName: The name of the file to look for in each directory# for additional configuration directives. See also the AllowOverride

# directive.#

AccessFileName .htaccess

## The following lines prevent .htaccess and .htpasswd files from being

# viewed by Web clients. #

Order allow,denyDeny from all

## TypesConfig describes where the mime.types file (or equivalent) is

# to be found.#

TypesConfig conf/mime.types

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

## The mod_mime_magic module allows the server to use various hints from the

# contents of the file itself to determine its type. The MIMEMagicFile# directive tells the module where the hint definitions are located.

#

MIMEMagicFile conf/magic

## 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: Control whether memory-mapping is used to deliver

# files (assuming that the underlying OS supports it).# The default is on; turn this off if you serve from NFS-mounted

# filesystems. On some systems, turning it off (regardless of# filesystem) can improve performance; for details, please see# http://httpd.apache.org/docs-2.0/mod/core.html#enablemmap

##EnableMMAP off

## EnableSendfile: Control whether the sendfile kernel support is

# used to deliver files (assuming that the OS supports it).# The default is on; turn this off if you serve from NFS-mounted

# filesystems. Please see# http://httpd.apache.org/docs-2.0/mod/core.html#enablesendfile

##EnableSendfile off

Page 21: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

## ErrorLog: The location of the error log file.

# If you do not specify an ErrorLog directive within a # container, error messages relating to that virtual host will be

# logged here. If you *do* define an error logfile for a # container, that host's errors will be logged there and not here.

#ErrorLog logs/error.log

## LogLevel: Control the number of messages logged to the error.log.

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

#LogLevel warn

## The following directives define some format nicknames for use with

# a CustomLog directive (see below).#

LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combinedLogFormat "%h %l %u %t "%r" %>s %b" common

LogFormat "%{Referer}i -> %U" refererLogFormat "%{User-agent}i" agent

# 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

## The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a # container, they will be logged here. Contrariwise, if you *do*

# define per- 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 refererCustomLog 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

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

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

ServerSignature On

## Aliases: Add here as many aliases as you need (with no limit). The format is

# Alias fakename realname#

# 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/". If the fakename is slash-terminated, then the # realname must also be slash terminated, and if the fakename omits the

# trailing slash, the realname must also omit it.#

Page 22: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

# We include the /icons/ alias for FancyIndexed directory listings. If you# do not use FancyIndexing, you may comment this out.

#Alias /icons/ "E:/AppServ/Apache/icons/"

Options Indexes MultiViewsAllowOverride None

Order allow,denyAllow from all

## 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/ "E:/AppServ/www/cgi-bin/"

## "C:/Program Files/Apache Group/Apache2/cgi-bin" should be changed to whatever your ScriptAliased

# CGI directory exists, if you have that configured.#

AllowOverride NoneOptions None

Order allow,denyAllow from all

## 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.# Example:

# Redirect permanent /foo http://www.example.com/bar

## Directives controlling the display of server-generated directory listings.

#

## IndexOptions: Controls the appearance of server-generated directory

# listings.#

IndexOptions FancyIndexing VersionSort

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

AddIconByType (TXT,/icons/text.gif) text/*AddIconByType (IMG,/icons/image2.gif) image/*AddIconByType (SND,/icons/sound2.gif) audio/*AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exeAddIcon /icons/binhex.gif .hqx

AddIcon /icons/tar.gif .tarAddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv

AddIcon /icons/compressed.gif .Z .z .tgz .gz .zipAddIcon /icons/a.gif .ps .ai .eps

AddIcon /icons/layout.gif .html .shtml .htm .pdfAddIcon /icons/text.gif .txt

AddIcon /icons/c.gif .cAddIcon /icons/p.gif .pl .py

AddIcon /icons/f.gif .forAddIcon /icons/dvi.gif .dvi

AddIcon /icons/uuencoded.gif .uuAddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl

AddIcon /icons/tex.gif .texAddIcon /icons/bomb.gif core

Page 23: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

AddIcon /icons/back.gif ..AddIcon /icons/hand.right.gif README

AddIcon /icons/folder.gif ^^DIRECTORY^^AddIcon /icons/blank.gif ^^BLANKICON^^

## DefaultIcon is which icon to show for files which do not have an icon

# explicitly set.#

DefaultIcon /icons/unknown.gif

## AddDescription allows you to place a short description after a file in# server-generated indexes. These are only displayed for FancyIndexed

# directories.# Format: AddDescription "description" filename

##AddDescription "GZIP compressed document" .gz

#AddDescription "tar archive" .tar#AddDescription "GZIP compressed tar archive" .tgz

AddType application/x-httpd-php .phpAddType application/x-httpd-php .php3

AddType application/x-httpd-php-source .phps

## ReadmeName is the name of the README file the server will look for by

# default, and append to directory listings.#

# HeaderName is the name of a file which should be prepended to# directory indexes.

ReadmeName README.htmlHeaderName 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* README* RCS CVS *,v *,t

## DefaultLanguage and AddLanguage allows you to specify the language of

# a document. You can then use content negotiation to give a browser a # file in a language the user can understand.

## Specify a default language. This means that all data

# going out without a specific language tag (see below) will # be marked with this one. You probably do NOT want to set

# this unless you are sure it is correct for all cases.#

# * It is generally better to not mark a page as # * being a certain language than marking it with the wrong

# * language!#

# DefaultLanguage nl#

# Note 1: The suffix does not have to be the same as the language# keyword --- those with documents in Polish (whose net-standard# language code is pl) may wish to use "AddLanguage pl .po" to# avoid the ambiguity with the common suffix for perl scripts.

## Note 2: The example entries below illustrate that in some cases

# the two character 'Language' abbreviation is not identical to # the two character 'Country' code for its country,

# E.g. 'Danmark/dk' versus 'Danish/da'.#

# Note 3: In the case of 'ltz' we violate the RFC by using a three char# specifier. There is 'work in progress' to fix this and get

# the reference data for rfc1766 cleaned up.#

# Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)

# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)

# Norwegian (no) - Polish (pl) - Portugese (pt)# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)

# Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)#

AddLanguage ca .caAddLanguage cs .cz .cs

AddLanguage da .dkAddLanguage de .de

Page 24: Cómo instalar y configurar un Servidor Web en Windows con Apache y PHP

AddLanguage el .elAddLanguage en .enAddLanguage eo .eoAddLanguage es .esAddLanguage et .etAddLanguage fr .fr

AddLanguage he .heAddLanguage hr .hrAddLanguage it .itAddLanguage ja .ja

AddLanguage ko .koAddLanguage ltz .ltzAddLanguage nl .nlAddLanguage nn .nnAddLanguage no .noAddLanguage pl .poAddLanguage pt .pt

AddLanguage pt-BR .pt-brAddLanguage ru .ruAddLanguage sv .sv

AddLanguage zh-CN .zh-cnAddLanguage zh-TW .zh-tw

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

#LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

## ForceLanguagePriority allows you to serve a result page rather than

# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)# [in case no accepted languages matched the available variants]

#ForceLanguagePriority Prefer Fallback

## Specify a default charset for all pages sent out. This is

# always a good idea and opens the door for future internationalisation# of your web site, should you ever want it. Specifying it as

# a default does little harm; as the standard dictates that a page# is in iso-8859-1 (latin1) u

Revisado por AjpdSoft el 25-08-2006.