Apache Cookbook
暫譯: Apache 食譜
Ken Coar, Rich Bowen
- 出版商: O'Reilly
- 出版日期: 2003-11-28
- 售價: $1,270
- 貴賓價: 9.5 折 $1,207
- 語言: 英文
- 頁數: 256
- 裝訂: Paperback
- ISBN: 0596001916
- ISBN-13: 9780596001919
已過版
買這商品的人也買了...
-
$680$537 -
$1,900$1,805 -
$1,500$1,425 -
$550$539 -
$970Introduction to Algorithms, 2/e
-
$2,475$2,351 -
$880$695 -
$1,930$1,834 -
$590$466 -
$1,330Linux Security Cookbook (Paperback)
-
$1,568Perl Cookbook, 2/e (Paperback)
-
$1,663Mastering Perl for Bioinformatics (Paperback)
-
$750$638 -
$560$476 -
$2,390$2,271 -
$1,254Postfix: The Definitive Guide (Paperback)
-
$490$387 -
$480$379 -
$750$593 -
$550$495 -
$620$490 -
$1,127Foundations of Algorithms Using C++ Pseudocode, 3/e (Hardcover)
-
$1,900$1,805 -
$1,264Learning The Bash Shell, 3/e (Paperback)
-
$5,760$5,472
商品描述
Summary
Apache is far and away the most widely used web server platform in the world. Both free and rock-solid, it runs more than half of the world's web sites, ranging from huge e-commerce operations to corporate intranets and smaller hobby sites, and it continues to maintain its popularity, drawing new users all the time. If you work with Apache on a regular basis, you have plenty of documentation on installing and configuring your server, but where do you go for help with the day-to-day stuff, like adding common modules or fine-tuning your activity logging?
The Apache Cookbook is a collection of problems, solutions, and practical examples for webmasters, web administrators, programmers, and everyone else who works with Apache. For every problem addressed in the book, there's a worked-out solution or "recipe"--short, focused pieces of code that you can use immediately. But this book offers more than cut-and-paste code. You also get explanations of how and why the code works, so you can adapt the problem-solving techniques to similar situations.
The recipes in the Apache Cookbook range from simple tasks, such installing the server on Red Hat Linux or Windows, to more complex tasks, such as setting up name-based virtual hosts or securing and managing your proxy server. The two hundred plus recipes in the book cover additional topics such as:
- Security
- Aliases, Redirecting, and Rewriting
- CGI Scripts, the suexec Wrapper, and other dynamic content techniques
- Error Handling
- SSL
- Performance
The impressive collection of useful code in this book is a guaranteed timesaver for all Apache users, from novices to advanced practitioners. Instead of poking around mailing lists, online documentation, and other sources, you can rely on the Apache Cookbook for quick solutions to common problems, and then you can spend your time and energy where it matters most.
Table of Contents
Preface
1. Installation
1.1 Installing from Red Hat Linux's Packages
1.2 Installing Apache on Windows
1.3 Downloading the Apache Sources
1.4 Building Apache from the Sources
1.5 Installing with ApacheToolbox
1.6 Starting, Stopping, and Restarting Apache
1.7 Uninstalling Apache
2. Adding Common Modules
2.1 Installing a Generic Third-Party Module
2.2 Installing mod_dav on a Unixish System
2.3 Installing mod_dav on Windows
2.4 Installing mod_perl on a Unixish System
2.5 Installing mod_php on a Unixish System
2.6 Installing mod_php on Windows
2.7 Installing the mod_snake Python Module
2.8 Installing mod_ssl
3. Logging
3.1 Getting More Details in Your Log Entries
3.2 Getting More Detailed Errors
3.3 Logging POST Contents
3.4 Logging a Proxied Client's IP Address
3.5 Logging Client MAC Addresses
3.6 Logging Cookies
3.7 Not Logging Image Requests from Local Pages
3.8 Logging Requests by Day or Hour
3.9 Rotating Logs on the First of the Month
3.10 Logging Hostnames Instead of IP Addresses
3.11 Maintaining Separate Logs for Each Virtual Host
3.12 Logging Proxy Requests
3.13 Logging Errors for Virtual Hosts to Multiple Files
3.14 Logging Server IP Addresses
3.15 Logging the Referring Page
3.16 Logging the Name of the Browser Software
3.17 Logging Arbitrary Request Header Fields
3.18 Logging Arbitrary Response Header Fields
3.19 Logging Activity to a MySQL Database
3.20 Logging to syslog
3.21 Logging User Directories
4. Virtual Hosts
4.1 Setting Up Name-Based Virtual Hosts
4.2 Designating One Name-Based Virtual Host as the Default
4.3 Setting Up Address-Based Virtual Hosts
4.4 Creating a Default Address-Based Virtual Host
4.5 Mixing Address-Based and Name-Based Virtual Hosts
4.6 Mass Virtual Hosting with mod_vhost_alias
4.7 Mass Virtual Hosting Using Rewrite Rules
4.8 SSL and Name-Based Virtual Hosts
4.9 Logging for Each Virtual Host
4.10 Splitting Up a LogFile
4.11 Port-Based Virtual Hosts
4.12 Displaying the Same Content on Several Addresses
5. Aliases, Redirecting, and Rewriting
5.1 Showing Highlighted PHP Source Without Symlinking
5.2 Mapping a URL to a Directory
5.3 Creating a New URL for Existing Content
5.4 Giving Users Their Own URL
5.5 Aliasing Several URLs with a Single Directive
5.6 Mapping Several URLs to the Same CGI Directory
5.7 Creating a CGI Directory for Each User
5.8 Redirecting to Another Location
5.9 Redirecting Several URLs to the Same Destination
5.10 Permitting Case-Insensitive URLs
5.11 Replacing Text in Requested URLs
5.12 Rewriting Path Information to CGI Arguments
5.13 Denying Access to Unreferred Requests
5.14 Rewriting Based on the Query String
5.15 Redirecting All-or Part-of Your Server to SSL
5.16 Turning Directories into Hostnames
5.17 Redirecting All Requests to a Single Host
5.18 Turning Document Names into Arguments
6. Security
6.1 Using System Account Information for Web Authentication
6.2 Setting Up Single-Use Passwords
6.3 Expiring Passwords
6.4 Limiting Upload Size
6.5 Restricting Images from Being Used Off-Site
6.6 Requiring Both Weak and Strong Authentication
6.7 Managing .htpasswd Files
6.8 Making Password Files for Digest Authentication
6.9 Relaxing Security in a Subdirectory
6.10 Lifting Restrictions Selectively
6.11 Authorizing Using File Ownership
6.12 Storing User Credentials in a MySQL Database
6.13 Accessing the Authenticated Username
6.14 Obtaining the Password Used to Authenticate
6.15 Preventing Brute-Force Password Attacks
6.16 Using Digest Versus Basic Authentication
6.17 Accessing Credentials Embedded in URLs
6.18 Securing WebDAV
6.19 Enabling WebDAV Without Making Files Writable by the Web User
6.20 Restricting Proxy Access to Certain URLs
6.21 Protecting Files with a Wrapper
6.22 Protecting All Files Except a Subset
6.23 Protecting Server Files from Malicious Scripts
6.24 Setting Correct File Permissions
6.25 Running a Minimal Module Set
6.26 Restricting Access to Files Outside Your Web Root
6.27 Limiting Methods by User
6.28 Restricting Range Requests
7. SSL
7.1 Installing SSL
7.2 Generating SSL Certificates
7.3 Generating a Trusted CA
7.4 Serving a Portion of Your Site via SSL
7.5 Authenticating with Client Certificates
8. Dynamic Content
8.1 Enabling a CGI Directory
8.2 Enabling CGI Scripts in Non-ScriptAliased Directories
8.3 Using Windows File Extensions to Launch CGI Programs
8.4 Using Extensions to Identify CGI Scripts
8.5 Testing That CGI Is Set Up Correctly
8.6 Reading Form Parameters
8.7 Invoking a CGI Program for Certain Content Types
8.8 Getting SSIs to Work
8.9 Displaying Last Modified Date
8.10 Including a Standard Header
8.11 Including the Output of a CGI Program
8.12 Running CGI Scripts as a Different User with suexec
8.13 Installing a mod_perl Handler from CPAN
8.14 Writing a mod_perl Handler
8.15 Enabling PHP Script Handling
8.16 Verifying PHP Installation
9. Error Handling
9.1 Handling a Missing Host Field
9.2 Changing the Response Status for CGI Scripts
9.3 Customized Error Messages
9.4 Providing Error Documents in Multiple Languages
9.5 Redirecting Invalid URLs to Some Other Page
9.6 Making Internet Explorer Display Your Error Page
9.7 Notification on Error Conditions
10. Proxies
10.1 Securing Your Proxy Server
10.2 Preventing Your Proxy Server from Being Used as an Open Mail Relay
10.3 Forwarding Requests to Another Server
10.4 Blocking Proxied Requests to Certain Places
10.5 Proxying mod_perl Content to Another Server
10.6 Configuring a Caching Proxy Server
10.7 Filtering Proxied Content
10.8 Requiring Authentication for a Proxied Server
11. Performance
11.1 Determining How Much Memory You Need
11.2 Benchmarking Apache with ab
11.3 Tuning Keepalive Settings
11.4 Getting a Snapshot of Your Site's Activity
11.5 Avoiding DNS Lookups
11.6 Optimizing Symbolic Links
11.7 Minimizing the Performance Impact of .htaccess Files
11.8 Disabling Content Negotiation
11.9 Optimizing Process Creation
11.10 Tuning Thread Creation
11.11 Caching Frequently Viewed Files
11.12 Sharing Load Between Servers Using mod_proxy
11.13 Distributing Load Evenly Between Several Servers
11.14 Caching Directory Listings
11.15 Speeding Up Perl CGI Programs with mod_perl
12. Miscellaneous Topics
12.1 Placing Directives Properly
12.2 Renaming .htaccess Files
12.3 Generating Directory/Folder Listings
12.4 Solving the "Trailing Slash" Problem
12.5 Setting the Content-Type According to Browser Capability
12.6 Handling Missing Host: Header Fields
12.7 Alternate Default Document
12.8 Setting Up a Default "Favicon"
A. Using Regular Expressions in Apache
B. Troubleshooting
Index
商品描述(中文翻譯)
摘要
Apache 是全球使用最廣泛的網頁伺服器平台。它既免費又穩定,運行著超過一半的全球網站,從大型電子商務運營到企業內部網路以及較小的興趣網站,並持續保持其受歡迎程度,吸引著不斷增長的新用戶。如果你經常使用 Apache,你會發現有大量的文檔來安裝和配置伺服器,但在日常操作中,例如添加常用模組或微調活動日誌時,你該去哪裡尋求幫助呢?
《Apache 食譜》是針對網頁管理員、網頁管理者、程式設計師以及所有使用 Apache 的人所編寫的一本問題、解決方案和實用範例的集合。書中針對每個問題都有詳細的解決方案或「食譜」—— 短小而專注的程式碼片段,你可以立即使用。但這本書提供的不僅僅是剪貼和粘貼的程式碼。你還會獲得程式碼如何運作的解釋,讓你能夠將問題解決技術應用於類似情況。
《Apache 食譜》中的食譜範圍從簡單的任務,例如在 Red Hat Linux 或 Windows 上安裝伺服器,到更複雜的任務,例如設置基於名稱的虛擬主機或保護和管理你的代理伺服器。書中超過兩百個食譜涵蓋了以下主題:
- 安全性
- 別名、重定向和重寫
- CGI 腳本、suexec 包裝器及其他動態內容技術
- 錯誤處理
- SSL
- 性能
這本書中令人印象深刻的有用程式碼集合,對於所有 Apache 用戶來說,無論是新手還是進階使用者,都是一個保證的省時工具。與其在郵件列表、在線文檔和其他來源中四處搜尋,不如依賴《Apache 食譜》來快速解決常見問題,然後將你的時間和精力花在最重要的地方。
目錄
前言
1. 安裝
1.1 從 Red Hat Linux 的套件安裝
1.2 在 Windows 上安裝 Apache
1.3 下載 Apache 源碼
1.4 從源碼構建 Apache
1.5 使用 ApacheToolbox 安裝
1.6 啟動、停止和重啟 Apache
1.7 卸載 Apache
2. 添加常用模組
2.1 安裝通用第三方模組
2.2 在類 Unix 系統上安裝 mod_dav
2.3 在 Windows 上安裝 mod_dav
2.4 在類 Unix 系統上安裝 mod_perl
2.5 在類 Unix 系統上安裝 mod_php
2.6 在 Windows 上安裝 mod_php
2.7 安裝 mod_snake Python 模組
2.8 安裝 mod_ssl
3. 日誌記錄
3.1 獲取日誌條目的更多細節
3.2 獲取更詳細的錯誤
3.3 記錄 POST 內容
3.4 記錄代理客戶端的 IP 地址
3.5 記錄客戶端 MAC 地址
3.6 記錄 Cookies
3.7 不記錄來自本地頁面的圖像請求
3.8 按天或小時記錄請求
3.9 每月第一天輪換日誌
3.10 記錄主機名稱而非 IP 地址
3.11 為每個虛擬主機維護單獨的日誌
3.12 記錄代理請求
3.13 將虛擬主機的錯誤記錄到多個文件
3.14 記錄伺服器 IP 地址
3.15 記錄引用頁面
3.16 記錄瀏覽器軟體名稱
3.17 記錄任意請求標頭字段
3.18 記錄任意響應標頭字段
3.19 將活動記錄到 MySQL 數據庫
3.20 記錄到 syslog
3.21 記錄用戶目錄
4. 虛擬主機
4.1 設置基於名稱的虛擬主機
4.2 將一個基於名稱的虛擬主機指定為默認
4.3 設置基於地址的虛擬主機
4.4 創建一個默認的基於地址的虛擬主機
4.5 混合基於地址和基於名稱的虛擬主機
4.6 使用 mod_vhost_alias 進行大規模虛擬主機設置
4.7 使用重寫規則進行大規模虛擬主機設置
4.8 SSL 和基於名稱的虛擬主機
4.9 為每個虛擬主機記錄
4.10 拆分日誌文件
4.11 基於端口的虛擬主機
4.12 在多個地址上顯示相同內容
5. 別名、重定向和重寫
5.1 顯示高亮的 PHP 源碼而不使用符號鏈接
5.2 將 URL 映射到目錄
5.3 為現有內容創建新 URL
5.4 為用戶提供自己的 URL
5.5 使用單個指令別名多個 URL
5.6 將多個 URL 映射到同一 CGI 目錄
5.7 為每個用戶創建 CGI 目錄
5.8 重定向到另一個位置
5.9 將多個 URL 重定向到同一目的地
5.10 允許不區分大小寫的 URL
5.11 替換請求 URL 中的文本
5.12 將路徑信息重寫為 CGI 參數
5.13 拒絕未引用請求的訪問
5.14 根據查詢字符串重寫
5.15 將整個或部分伺服器重定向到 SSL
5.16 將目錄轉換為主機名稱
5.17 將所有請求重定向到單一主機
5.18 將文檔名稱轉換為參數
6. 安全性
6.1 使用系統帳戶信息進行網頁身份驗證
6.2 設置一次性密碼
6.3 密碼過期
6.4 限制上傳大小
6.5 限制圖像的外部使用
6.6 同時要求弱和強身份驗證
6.7 管理 .htpasswd 文件
6.8 為摘要身份驗證創建密碼文件
6.9 在子目錄中放寬安全性
6.10 有選擇性地解除限制
6.11 使用文件擁有權進行授權
6.12 在 MySQL 數據庫中存儲用戶憑證
6.13 訪問經過身份驗證的用戶名
6.14 獲取用於身份驗證的密碼
6.15 防止暴力破解密碼攻擊
6.16 使用摘要與基本身份驗證
6.17 訪問嵌入在 URL 中的憑證
6.18 保護 WebDAV
6.19 啟用 WebDAV 而不使文件可由網頁用戶寫入
6.20 限制代理訪問某些 URL
6.21 使用包裝器保護文件
6.22 除子集外保護所有文件
6.23 保護伺服器文件免受惡意腳本攻擊
6.24 設置正確的文件權限
6.25 運行最小模組集
6.26 限制對網頁根目錄外文件的訪問
6.27 按用戶限制方法
6.28 限制範圍請求
7. SSL
7.1 安裝 SSL
7.2 生成 SSL 證書
7.3 生成受信任的 CA
7.4 通過 SSL 提供網站的一部分
7.5 使用客戶端證書進行身份驗證
8. 動態內容
8.1 啟用 CGI 目錄
8.2 在非腳本別名目錄中啟用 CGI 腳本
8.3 使用 Windows 文件擴展名啟動 CGI 程式
8.4 使用擴展名識別 CGI 腳本
8.5 測試 CGI 是否正確設置
8.6 讀取表單參數
8.7 為某些內容類型調用 CGI 程式
8.8 使 SSI 正常工作
8.9 顯示最後修改日期
8.10 包含標準標頭
8.11 包含 CGI 程式的輸出
8.12 使用 suexec 以不同用戶身份運行 CGI 腳本
8.13 從 CPAN 安裝 mod_perl 處理器
8.14 編寫 mod_perl 處理器
8.15 啟用 PHP 腳本處理
8.16 驗證 PHP 安裝
9. 錯誤處理
9.1 處理缺失的主機字段
9.2 更改響應 S...