Red Hat DIRECTORY SERVER 2.0 - GATEWAY Manuel d'utilisateur

Naviguer en ligne ou télécharger Manuel d'utilisateur pour Serveurs Red Hat DIRECTORY SERVER 2.0 - GATEWAY. Web Server Management: Running Apache 2 on Red Hat Linux [en] Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 96
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 0
Web Server Management: Running Apache 2 on Red
Hat Linux
Bob Dowling
University of Cambridge Computing Service
Vue de la page 0
1 2 3 4 5 6 ... 95 96

Résumé du contenu

Page 1 - Hat Linux

Web Server Management: Running Apache 2 on RedHat LinuxBob DowlingUniversity of Cambridge Computing [email protected]

Page 2

Chapter 1. Installing the softwarecgi−binerrorhtmlicons*.html.varincludebottom.htmlspacer.htmltop.htmlusagemsfree.pngwebalizer.png*.png/var/wwwFigure

Page 3 - Table of Contents

Chapter 1. Installing the software• /usr/bin/ab: This a stress-tester for the web server. Please do not stress-testpeople’s servers without their expl

Page 4

Chapter 1. Installing the software# cd# /etc/init.d/httpd startStarting httpd: [ OK ]Figure 1-12. Manually starting the web serverIf you take this eas

Page 5

Chapter 1. Installing the softwareWarningusermod’s -G option sets the user’s groups. It does not add tothem. You must quote all the user’s groups. Any

Page 6 - Installing the packages

Chapter 1. Installing the software10

Page 7

Chapter 2. The site’s designThis chapter will describe the design of a web site that we will set as our goal for thiscourse and discuss a small amount

Page 8

Chapter 2. The site’s designMultiple addresses:A single system need not have a single IP address. It can have many and each canhave a different web si

Page 9 - Changes made to the system

Chapter 2. The site’s designHost: noether.csi.cam.ac.ukThe second line indicates which server the query was addressed to. It is thiselement of the que

Page 10 - /etc/group:apache:x:48:

Chapter 2. The site’s designKeep-Alive: 300This instructs the server to keep the connection alive for 300 seconds in casethere are any more requests.

Page 11 - Quick and Dirty Web Server

Chapter 3. Getting startedClean slate:We will start by removing the existing configuration script. This may seem dramaticbut this course seeks to expla

Page 12

Web Server Management: Running Apache 2 on Red Hat Linuxby Bob DowlingInstallation:This course will first illustrate how to load the Apache 2 package o

Page 13 - # usermod -G webadmin bob

Chapter 3. Getting startedWe will start by detailing an absolutely minimal configuration file that gets the serverlaunched but nothing else.Listen 80Fig

Page 14

Chapter 3. Getting startedListen 80User apacheGroup apacheServerRoot /etc/httpdOptions NoneFigure 3-8. httpd.conf: Minimal versionSyntax summary: Gett

Page 15 - Chapter 2. The site’s design

Chapter 3. Getting startedreason the parent decides whether or not to replace it. (If they have all been idle forthe past 48 hours it may decide that

Page 16 - HTTP Query Structure

Chapter 3. Getting startedentitled to update the sites.# cd /var/www# mkdir CHALK CHEESE# groupadd -r chalk# groupadd -r cheese# chgrp chalk CHALK# ch

Page 17

Chapter 3. Getting startedServerNameThis sets the name of the server for the virtual host. If a query’s Host: headerdoes not match this then the virtu

Page 18

Chapter 3. Getting startedstopStops the web server.restartStops and starts the web server.condrestartStops and starts the web server if the PID file ex

Page 19 - Chapter 3. Getting started

Chapter 3. Getting started22

Page 20 - Starting httpd: [ OK ]

Chapter 4. Supporting MIME typesMIME types:We will start with a very brief discussion about what MIME types are and in partic-ular what MIME content t

Page 21

Chapter 4. Supporting MIME typesContent analysisThe first is to look in the file’s content and deduce the MIME content type from thecontent.You can see

Page 22 - Use valid DNS names

Chapter 4. Supporting MIME typesLoading and using the MIME moduleModules:All the various elements of web server functionality are split out into modul

Page 23 - Syntax summary: Virtual hosts

Table of Contents1. Installing the software...1The w

Page 24 - /etc/init.d/httpd

Chapter 4. Supporting MIME typesFigure 4-7. chalk.dept.cam.ac.uk index page as HTMLSyntax summary: Loading modulesLoadModule library.so nameLoad the m

Page 25

Chapter 5. Symbolic linksSymbolic linksIt is demonstrated that the web server does not follow symbolic links unless explicitlydirected to do so.Option

Page 26

Chapter 5. Symbolic linksFigure 5-2. We are forbidden to access main.htmlTo instruct the web server to follow symbolic links we need to set an option.

Page 27

Chapter 5. Symbolic linksFigure 5-4. We are permitted to access main.htmlBecause symbolic links might be used to circumvent access controls in the web

Page 28

Chapter 5. Symbolic links30

Page 29 - TypesConfig /etc/mime.types

Chapter 6. Handling directoriesDirectory URLsSome URLs (typically those that end in /) correspond to directories rather than plainfiles. We need to det

Page 30 - Syntax summary: mime_module

Chapter 6. Handling directoriesThere are two solutions to this issue. The first, and simplest, is to nominate a filename(such as index.html) and instruc

Page 31 - Chapter 5. Symbolic links

Chapter 6. Handling directoriesSyntax summary: dir_moduleDirectoryIndexSpecify the documents to be searched for given a directory query.Document names

Page 32 - Options +FollowSymLinks

Chapter 6. Handling directoriesSeveral options we will meet rely on a specific module and their use must follow theLoadModule lin in the configuration fi

Page 33

Chapter 6. Handling directoriesFigure 6-9. The fancy index of /Columns in default fancy index• Name• Size• Last modified• DescriptionThe layout of this

Page 35 - / causing problems

Chapter 6. Handling directoriesFigure 6-10. A populated cheese.dept.cam.ac.uk websiteManipulating columnsWe will start by making some use of the Descr

Page 36 - Using default documents

Chapter 6. Handling directoriesFigure 6-12. The cheese.dept.cam.ac.uk website with descriptionsNext, we will remove unwanted columns. For the sake or

Page 37 - Syntax summary: dir_module

Chapter 6. Handling directoriesFigure 6-14. The displayed listing with columns suppressedFinally, we will look at modifying the widths of the various

Page 38

Chapter 6. Handling directoriesscription of the file if it would push the row beyond this point and indicates the trun-cation with a “>”. There are

Page 39 - • Description

Chapter 6. Handling directoriesFigure 6-18. Unwanted files in the listingIndexIgnore "#*#" "*~"Figure 6-19. httpd.conf: Ignoring ce

Page 40 - Manipulating columns

Chapter 6. Handling directoriesFigure 6-20. Unwanted files removed from the listingWarningJust because a file name is not in the listing does not mean t

Page 41

Chapter 6. Handling directoriesFigure 6-22. Putting subdirectories first in the listingNote: By now you may be starting to get confused about when a fa

Page 42

Chapter 6. Handling directoriesthem in directory listings. The auto-indexing module provides a slew of commandsfor this purpose. The trick to producin

Page 43 - Manipulating rows

Chapter 6. Handling directoriesAddIcon /icons/dir.gif "^^DIRECTORY^^"AddIcon /icons/back.gif ".."AddAlt "Directory" &quo

Page 44

Chapter 6. Handling directoriesTo add HTML above the listing the configuration must identify a header file. This filemust have a name that identifies it a

Page 45

Chapter 1. Installing the softwarePackages:We will describe the packages that Red Hat install if you request the Web Server groupat installation. We w

Page 46 - Adding icons to the listing

Chapter 6. Handling directories</head><body bgcolor="#ffffff" text="#000000"link="#003399" alink="#cc0000&

Page 47

Chapter 6. Handling directoriesIndexOptions ... HTMLTable ...Figure 6-34. httpd.conf: Using HTML tables for the indexFigure 6-35. The listing in HTML

Page 48 - Adding text to the listing

Chapter 6. Handling directoriesAddIconByType icon mime_type (f)Specifies the icon that should be used for a particlar MIME content type. TheMIME conten

Page 49

Chapter 6. Handling directoriesFoldersFirstList the subdirectories before the plain files.SuppressHTMLPreambleInstructs the web server not to create th

Page 50 - Using an HTML table

Chapter 6. Handling directoriesLoadModule dir_module modules/mod_dir.soDirectoryIndex index.htmlLoadModule autoindex_module modules/mod_autoindex.soIn

Page 51

Chapter 7. LoggingError logWe will examine the error log to see what is logged and to change the amount oflogging done.log_config_moduleWe will load an

Page 52

Chapter 7. Logging[Mon Mar 24 09:50:58 2003] [notice] caught SIGTERM, shutting downFigure 7-2. error_log: Shutting downAnalogous to SIGHUP is SIGTERM

Page 53 - Using both modules

Chapter 7. LoggingSyntax error on line 10 of /etc/httpd/conf/httpd.conf:Invalid directory indexing optionFigure 7-4. error_log: Unformatted error mess

Page 54 - DirectoryIndex index.html

Chapter 7. LoggingThis provides us with one particularly useful command: CustomLog. This allows usto specify what information to record and where to r

Page 55 - Chapter 7. Logging

Chapter 7. Logging• There is no record of whether chalk.dept.cam.ac.uk or cheese.dept.cam.ac.uk wasqueried.• The hostnames are addresses, not namesThe

Page 56 - • message

Chapter 1. Installing the softwarephp-ldapThis package provides the hooks for PHP to perform lookups in LDAP directo-ries.php-pgsqlThis package provid

Page 57 - Access logs

Chapter 7. LoggingThe escape sequences used in the Common Log Format%hThe client’s hostname%lIf the web server was doing IDENT (RFCnnnn) lookups then

Page 58 - Four escape sequences

Chapter 7. LoggingFinding bad linksMost browsers also include a query header Referer: which contains the URL of thepage that contain the link the user

Page 59

Chapter 7. LoggingThe three commands that specify how often rotation should take place are daily,weekly and monthly.rotate 4Keep four sets of log files

Page 60

Chapter 7. Logging/bin/kill -HUP ‘cat /var/run/httpd.pid 2>/dev/null‘ 2> /dev/null || trueThis messy command sends a SIGHUP signal to the master

Page 61 - Log rotation

Chapter 7. Logging# mkdir /var/www/CHALK/usage# mkdir /var/www/CHEESE/usage# chmod g+ws /var/www/CHALK/usage# chmod g+ws /var/www/CHEESE/usageFigure 7

Page 62 - : commands

Chapter 7. LoggingWe need to run it multiple times for our various web sites using its command lineoption to select non-standard configuration files.#!/

Page 63 - Log file analysis

Chapter 7. Logging62

Page 64

Chapter 8. Users’ own web pagesuserdir_moduleWe will introduce the relevant module and the single command it provides.Simple useWe will start with the

Page 65

Chapter 8. Users’ own web pageslooking for. Only the last entry in the list is allowed to be a redirection to anotherserver (i.e. a URL) because when

Page 66

Chapter 9. Delegated control<Directory>Applying a specialised set of commands just to a subdirectory of a web site from thehttpd.conf file.Includ

Page 67

Chapter 1. Installing the software$ \/bin/su -Password: password#Figure 1-1. Changing to be rootUnix Support keeps the Red Hat distributions on an NFS

Page 68

Chapter 9. Delegated controlFigure 9-2. The games directoryWe can turn indexing off with the Options command as follows.<VirtualHost *>ServerNam

Page 69 - Chapter 9. Delegated control

Chapter 9. Delegated controlFigure 9-4. Not the games directoryThe Options command sets various parameters that basically control whether a mod-ule’s

Page 70

Chapter 9. Delegated controltells of its origins; it was used to set the access rights for a directory tree. It is, however,a fully generic delegated

Page 71 - Indexes which enables

Chapter 9. Delegated controlAllowOverride IndexesThe delegated configuration file is allowed to run the IndexOptions commandand all the commands that mo

Page 72 - Simple uses of AllowOverride

Chapter 9. Delegated control70

Page 73

Chapter 10. Access controlTwo waysThere are two ways to do access control: by the location of the client and by theidentity of the user operating the

Page 74

Chapter 10. Access controlAccess control by client IP addressAs ever, this functionality is provided by a module: access_module from librarymod_access

Page 75 - Chapter 10. Access control

Chapter 10. Access controlquery redirected through a web proxy or cache will have the address of the webproxy or cache.Allow from 131.111Access is all

Page 76

Chapter 10. Access controlWhat we need to know is how to set up the server so that userids and passwords areknown to the server and certain pages are

Page 77 - </Directory>

Chapter 10. Access controlNow that we have a way to identify users we need to specify policies. As with ac-cess_module the restrictions on access can

Page 78

Chapter 1. Installing the software# cd RedHat/RPMS# ls4Suite-0.11.1-10.i386.rpma2ps-4.13b-24.i386.rpmabiword-1.0.2-6.i386.rpm...zlib-1.1.4-4.i386.rpmz

Page 79

Chapter 10. Access controlFigure 10-8. The userid and password challengeNote that the prompt contains the phrase “Restricted area”. That text comes di

Page 80

Chapter 10. Access control<Directory /var/www/CHEESE/games>AuthType BasicAuthName "Cheese lovers only"AuthUserFile /etc/httpd/access/p

Page 81 - Syntax summary: Require

Chapter 10. Access control$ touch /etc/httpd/access/digest_pw$ htdigest /etc/httpd/access/digest_pw "Cheese lovers only" rjd4Adding user rjd

Page 82 - New password: password

Chapter 10. Access controlSatisfy any</Directory>Figure 10-15. Mixed restrictionsThe two worlds of access control are joined by the Satisfy comm

Page 83

Chapter 10. Access control80

Page 84

Chapter 11. ConclusionWhat’s next?University Computing Service courses that have this course as a prerequisite.Tidying upSome re-ordering of the final

Page 85 - Chapter 11. Conclusion

Chapter 11. Conclusion# Put a header file above the listingHeaderName HEADER.html# Set up aliasingAlias /icons/ /var/www/icons/# Set up iconsAddIconBy

Page 86

Chapter 11. ConclusionNameVirtualHost *<VirtualHost *>ServerName chalk.dept.cam.ac.ukDocumentRoot /var/www/CHALKCustomLog logs/chalk.log clf<

Page 87 - Follow-on web server courses

Chapter 11. ConclusionCGI Scripting for Programmers: IntroductionThe Common Gateway Interface (CGI) underlies much of the modern web. It pro-vides the

Page 88

Appendix A. Apache modulesThis lists the modules shipped with Red Hat Linux’s packages.Table A-1. Modules shipped as part of the base httpd package.Li

Page 89 - Appendix A. Apache modules

Chapter 1. Installing the softwareChanges made to the systemWe should quickly examine what changes have been made to the system by the in-stallation o

Page 90

Appendix A. Apache modulesLibrary Module name Descriptionmod_info.so info_module Lets the server report on itsconfiguration via a web request.mod_log_c

Page 91

Appendix A. Apache modulesTable A-2. Modules shipped as part of other packages.Package Library Module namemod_auth_mysql mod_auth_mysql.so mysql_auth_

Page 92

Appendix A. Apache modules88

Page 93 - -” is inserted

Appendix B. Reference information for loggingTable B-1. Escape sequences for custom logs%% How to get “%” in the log line. Why would you want to?%a Cl

Page 94

Appendix B. Reference information for loggingTable B-2. HTTP status codes100 Continue101 Switching protocols200 OK201 Created202 Accepted203 Nonauthor

Page 95

Appendix B. Reference information for loggingNotes1. http://www.w3.org/Protocols/rfc2616/rfc2616.html91

Page 96

Appendix B. Reference information for logging92

Commentaires sur ces manuels

Pas de commentaire