Slides Apache 2x2
Slides Apache 2x2
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Introduction: Presentation of Apache 3 Introduction: Presentation of Apache 4
How does a web server run ? World Wide Web - Client
Server Architecture
I A “Server” application (deamon) listen to a
communication port Files
URL = Request
I standard port: 80 (< 1024 hence only root can access)
I “Master” server: run with root id; listen to port 80 Browser Server
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Introduction: Principles of a Web Server 5 Introduction: Principles of a Web Server 6
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Introduction: Principles of a Web Server 7 Apache: Installation 8
Configure the server httpd.conf : network
I ServerType : inetd or standalone;
I ServerName : name returned to the client (must be in the
DNS);
I Configuration of the HTTP Deamon : httpd.conf I Port : port used by the master (80 for the standard
I Port, user ID, root of the server, timeouts, virtual servers, configuration);
number of clients, etc. I BindAddress : Used to limit IP addresses (if more than one);
I Virtual Hosts can be inculded or imported from separate files I Listen : replaces Port and BindAddress if more than one IP
address;
I HostnameLookups : on or off, reserch of the name of the
client;
I User and Group : user ID and group ID for slave processus;
I ServerAdmin : email of the administrator.
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Apache Configuration 9 Apache Configuration: Network and Connexions 10
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Apache Configuration: Network and Connexions 11 Apache Configuration: Network and Connexions 12
httpd.conf : files httpd.conf : Log files
I ServerRoot : root directory of the server Log files
I ErrorLog : name of the file containing the log of errors ;
ServerRoot "/home/bie/"
ErrorLog logs/error_log
I DocumentRoot : root directory of the files I LogLevel : Level of the message for the error log (debug,
DocumentRoot "htdocs" info, notice, warn, error, crit, alert, emerg)
or
LogLevel warn
DocumentRoot "/home/bie//htdocs"
I LogFormat Defines a new format for log files
I UserDir : root of user home (corresponds to
http://<server>/~<user>) LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"
%{User-Agent}i\"" combined
UserDir www
or
LogFormat "%h %l %u %t \"%r\" %>s %b" common
UserDir public_html LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
I PidFile : where does httpd put its pid when started.
I CustomLog : name and format of access files
<IfModule !mpm_netware.c> PidFile logs/httpd.pid CustomLog logs/access_log common
</IfModule>
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Apache Configuration: File Handling 13 Apache Configuration: Log Files 14
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Apache Configuration: Log Files 19 Apache Configuration: Log Files 20
Control on the operations Control on the operations
I Some orders are only valid for a specific directory (Cont.)
<Directory dir name> orders </Directory>
<Directory "/opt/lampp/htdocs">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All I Or for files matching a specific regular expression
Order allow,deny <FilesMatch regExp> orders </FilesMatch>
Allow from all
</Directory> <FilesMatch "^\.ht">
Order allow,deny
Deny from all
I Or if a module was loaded (they are only valid for this module)
</FilesMatch>
<IfModule module name> orders </IfModule>
<IfModule dir_module>
DirectoryIndex index.html index.html.var index.php index.php3 index.php4
</IfModule>
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Apache Configuration: Control Instructions 21 Apache Configuration: Control Instructions 22
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Apache Configuration: Authorizations and Access Control 25 Apache Configuration: Authorizations and Access Control 26
Web Programming 8) Web Server: Principles and Configuration Web Programming 8) Web Server: Principles and Configuration
Virtual Hosts 29 Virtual Hosts 30