1. Apache Web Server
Instalación y Configuración
MSc. Javier González Sánchez
javiergs@itesm.mx
ITESM, campus Guadalajara
2. Introducción
1
¿cómo funciona el www?
HTTP – el web y sus protocolos
2
Historia del proyecto Apache
¿ que es Apache ?
Arquitectura de Apache
3
Instalación y configuración
4.
Problemas y adiciones finales.
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
3. ¿ cómo funciona el www ?
El www se basa en el paradigma cliente / servidor.
transacción www
1. DNS
Lookup DNS Server
URL
2. TCP connection
3. HTTP request
4. HTTP response
Web Server
browser Web Client
tracert
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
4. HTTP – el web y sus protocolos
protocolo, (elaborado por Tim Berners - Lee) en 1989
protocolo a nivel de aplicación (dependiente de TCP/IP)
El cliente (browser) elabora una petición (request)
El servidor (web Server) responde la petición (response)
soporta:
uso de URL’s (Uniform Resource Locator´s)
Internet media types (MIME types: RFC2045-RFC2049)
i.e. acceso a diferentes tipos de informacion
estándar:
HTTP 1.0 (RFC 1945), HTTP 1.1 (RFC 2616)
http:// www.tallersur.com:80 / directory/file.html
browser protocolo server name or IP puerto directorio / archivo
telnet
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
5. HTTP (request / response)
Simple client request
GET /index.html HTTP/1.1
Host: www.gda.ites.mx
HTTP/1.1 200 OK Server reply
Date: Tue, 09 Jan 2001 10:49:14 GMT
Server: Apache/1.3.14 (Unix)
Last-Modified: Tue, 09 Jan 2001 01:11:02 GMT
ETag: "131e-a074-3a5a6526"
Accept-Ranges: bytes
Content-Length: 41076
Content-Type: text/html
<html>
…
</html>
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
6. Códigos de respuesta
Los códigos de estatus son números de tres dígitos
agrupados como sigue:
• 1xx - informational
• 2xx - client request successful
200 - OK
• 3xx - request redirected
• 4xx - client errors (request incomplete)
403 - Forbidden
404 - Not found
• 5xx - server errors
browser
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
8. proyecto Apache HTTP
objetivo
proporcionar un servidor open-source, seguro, eficiente y
extensible que proporcione servicios HTTP acorde a los
estándares del www.
Apache Group
Organización no lucrativa
Desarrollo de parches y módulos adicionales
Aprobar e implementa parches y adiciones enviadas por
desarrolladores externos al grupo.
Prueba de nuevas versiones
Documentar nuevas características
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
9. ¿ que es Apache?
Disponible de forma gratuita :
Código fuente y objeto
Para diferentes plataformas
Basado en el server de NCSA (1995)
Estadísticas
El 60% de los servidores web en Internet son Apache o
un derivado de Apache
Totalmente configurable, muchas directivas...
Módulos adicionales le proveen funcionalidad extra
Apache is “A PAtCHy server”
Excelente rendimiento y actualizaciones continuas
netscaft
port80
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
13. obtener
La Precompilada
El Código Fuente
Instalar
Plataformas
Iniciar el Servidor
Detener el Servidor
Configurar
conf/httpd.conf
Seguridad
Compatibilidad
instalación
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
21. Apache directorios
cgi-bin/ - CGI scripts directory
conf/ - configuration files for httpd server
htdocs/ - main directory for documents
logs/ - directory with log files
other stuff (bin/, icons/, include/,proxy/, man/
…)
bin cgi-bin conf htdocs libexec logs
apachectl ab httpd htpasswd
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
22. configuración
Choosing functionality
Apache functionality is available through
modules which are either built into or loaded
into the server
Apache reads its run-time configuration
instructions from text files
No GUI available
General rules
case insensitive(exclude a file/directory names)
one directive in per line
extra whitespace is ignored
comment lines begin with #
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
23. configuración
How ? (It’s basic configuration)
ServerType standalone
Port 80
User nobody
Group nobody
ServerAdmin your_e-mail_address
ServerRoot /usr/local/apache
ErrorLog /usr/local/apache/logs/error_log
TransferLog /usr/local/apache/logs/access_log
DocumentRoot /usr/local/apache/htdocs/
UserDir public_html
DirectoryIndex index.html
ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/
More Directives :
StartServers, Min/MaxSpareServers, MaxClients, …
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
24. En conclusión
Pros:
• Precio (de libre uso, gratuito).
• Desempeño y Robustez.
• Solidez.
• Seguridad.
• Soporte para el protocolo HTTP 1.1.
• Extensibilidad.
• Rápido soporte vía grupo de noticias.
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
25. En conclusión
Contras:
• No existe una versión para MAC.
• La versión para WinNT es todavía débil (No
posee aún el crecimiento en el desempeño
obtenido en las versiones UNIX).
• Carece de interfaces gráficas para facilitar las
tareas de configuración y administración.
• Un soporte técnico más extenso requiere de
comprar el servicio a un tercero.
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
27. bitácoras
servers logs access information in the file
it is possible (and easy) to produce many kinds of
activity reports from that data
plenty of freeware log analyzers (webalizer, analog,…)
Common Log Format (CLF)
211.52.197.57 - - [03/Aug/2000:21:57:26 +0900] "POST /cgi-bin/bbs HTTP/1.1" 200 3840
Date request status
host ident [day/month/year:hour:minute:second zone]
authuser bytes
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
28. virtual host
The term Virtual Host refers to the practice of maintaining
more than one server on one machine, as differentiated by
their apparent hostname.
NSPs and ISPs do this a lot
Allows additional Web presence without accompanying
hardware or software investment required
each of the virtual server may have totally different
content, configuration, separate log and error files, …
alternative is to run another server on a different port
part of basic server configuration (httpd.conf)
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
29. módulos apache
La arquitectura modular hace posible para
“cualquiera” añadir funciones al servidor
Existe una enorme cantidad de módulos
escritos para Apache (públicos y privados)
Es fácil añadir un modulo a Apache
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
30. otros proyectos Apache
o Apache-SSL
o PHP Project
o Apache / Perl Integration Project
o Java-Apache Project / Jakarta Project
o Apache Graphical User Interface Project
o Apache Documentation Project
o XML-Apache Project
Apache.org o etc…
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
32. referencias
Apache HTTP Server Project
http://www.apache.org/info.html
Apache API notes
http://www.apache.org/docs/misc/API.html
Netcraft Survey
http://www.netcraft.com
Apache Week
http://www.apacheweek.com/issues/00-02-18
Apache modules
http://www.apache.org/docs/mod/index.html
Apache directives
http://www.apache.org/docs/mod/directives.html
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
33. sitios de interés
WWW consortium
http://www.w3c.org
About NCSA
http://www.ncsa.uiuc.edu/AboutUs/
Netcraft Survey for Apache
http://www.serverwatch.com/news/article.php/3073801
port 80 Survey for Apache
http://www.port80software.com/surveys/top1000webservers/archive/200301/
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)
34. problemas
Revisar el archivo error.log !
Revisar el FAQ Apache
http://www.apache.org/docs/misc/FAQ.html
Leer la documentación de Apache
Revisar la base de datos de reportes de
errores (bugs)
http://bugs.apache.org/
M.Cs. Javier Gonzalez Sanchez (javiergs@itesm.mx)