詳細概括Linux Apache系統(tǒng)配置文件
Linux有很多值得學(xué)習(xí)的地方,這里我們主要介紹配置Linux Apache2,Linux發(fā)行版Fedora Core Linux,而Red Hat公司原來Red Hat Linux的開發(fā)團隊也將繼續(xù)參與這一發(fā)行版本的開發(fā)工作。
配置SUSE http server,首先可以選擇YaST工具,比較直觀。為了配置更精細和可靠,我們最好選擇手工配置http server。在配置時請以root帳戶來編輯http server的配置文件。默認文件系統(tǒng)和應(yīng)用程序布局在配置Linux Apache2前,首先需要了解Linux Apache包在系統(tǒng)中的文件。
二進制文件
SUSE Linux Apache 中的大多數(shù)可執(zhí)行文件均追加了一個 2。對于 Linux Apache 1.x 和Linux Apache 2.x 的并行安裝,這可簡單地區(qū)分二進制文件。/usr/sbin/httpd2指向所選多處理模塊的符號鏈接,默認值為 httpd2-prefork。根據(jù) MPM 的系統(tǒng)配置設(shè)置,符號鏈接由啟動腳本維護。/usr/sbin/httpd2-prefork實際的 Linux Apache2 可執(zhí)行文件。/usr/sbin/apache2ctl由 Apache HTTPD 項目提供,用來啟動和停止萬維網(wǎng)服務(wù)器的控制腳本。/etc/init.d/apache2
啟動和停止腳本,為 SUSE Linux 安裝提供完全集成并在引導(dǎo)時啟動 Linux Apache。該操作在啟動和停止服務(wù)器之前檢查是否存在有效的配置并覆蓋配置位置。并允許用戶能很容易地包含更多的配置文件、裝載模塊甚或另外啟動一個服務(wù)器實例(而不需修改腳本)。/usr/sbin/rcapache2
/etc/init.d/apache2 的方便的符號鏈接,因為默認情況下 /etc/init.d/ 不在路徑中。僅僅使用 rcapache2 start 來啟動 Linux Apache。/usr/sbin/htpasswd2用來生成加密的口令以支持基于 .htaccess 的鑒定的實用程序。請參見htpasswd2(1) 手冊頁,以獲得如何使用此工具的詳細信息。
配置文件
大多數(shù)配置文件駐留在 /etc/apache2 中。/etc/apache2/httpd.conf頂級配置文件。如果可能的話,請避免更改此文件。該文件主要包含其他配置文件并聲明全局設(shè)置。/etc/apache2/*.conf一些外部 Linux Apache 模塊將其配置文件放置在目錄 /etc/apache2/ 中,通常使用本身的模塊名作為前綴(mod_*.conf)。
uid.conf . . . . . . . . . . . . . . UserID/GroupID to run under
server-tuning.conf . . . . . . . . . sizing of the server (how many processes to start, ...)
listen.conf . . . . . . . . . . . . . IP adresses / ports to listen on
mod_log_config.conf . . . . . . . . . define logging formats
mod_status.conf . . . . . . . . . . . restrict access to mod_status (server monitoring)
mod_info.conf . . . . . . . . . . . . restrict access to mod_info
mod_usertrack.conf . . . . . . . . . defaults for cookie-based user tracking
mod_autoindex-defaults.conf . . . . . defaults for displaying of server-generated directory listings
mod_mime-defaults.conf . . . . . . . defaults for mod_mime configuration
errors.conf . . . . . . . . . . . . . customize error responses
ssl-global.conf . . . . . . . . . . . SSL conf that applies to default server _and all_ virtual hosts
default-server.conf . . . . . . . . . set up the default server that replies to non-virtual-host requests
mod_userdir.conf . . . . . . . . enable UserDir (if mod_userdir is loaded)
/etc/apache2/conf.d/*
存放隨某些包提供的各種其他配置文件的目錄。
/etc/apache2/vhosts.d/*
存放虛擬主機可選配置文件的目錄。
/etc/sysconfig/apache2
與 Linux Apache2 相關(guān)的 SUSE Linux 配置文件。該文件存放用于控制 Linux Apache萬維
網(wǎng)服務(wù)器的所有相關(guān)配置參數(shù)。
/etc/apache2/sysconfig.d/*
存放啟動或重啟動萬維網(wǎng)服務(wù)器時/etc/sysconfig/apache2 自動創(chuàng)建或編輯的文件。
•/etc/apache2/sysconfig.d/loadmodule.conf - 在運行時裝載的模塊
• /etc/apache2/sysconfig.d/global.conf - 服務(wù)器范圍的一般設(shè)置
• /etc/apache2/sysconfig.d/include.conf - 包含的配置文件的列表
不要手工編輯這些文件。而是在 /etc/sysconfig/apache2 中編輯相應(yīng)的設(shè)置。
日志文件
默認情況下,Linux Apache 在以下文件中提供有關(guān)其運行時狀態(tài)的各種信息:
/var/log/apache2/error_log
Linux Apache 將啟動和關(guān)閉通知以及所有運行時錯誤記錄在此文件中。
/var/log/apache2/access_log
對萬維網(wǎng)服務(wù)器的所有請求均記錄在此文件中。項的默認格式是組合格式,顯示有關(guān)發(fā)送請求和參照 URI 的主機和用戶代理的信息。
文檔根目錄
物理目錄 /srv/www/htdocs 是 Linux Apache 處理萬維網(wǎng)網(wǎng)頁的默認位置。該目錄用作客戶程序請求的“根目錄”。要使用 Linux Apache 發(fā)布萬維網(wǎng)網(wǎng)頁,請在該目錄中或該目錄下分層存儲文件。在 SUSE Linux 中的默認 Linux Apache 配置中,針對名為 example.com 的域,像http://www.example.com/index.html 的 URL 會指向 /srv/www/htdocs/index.html。
【編輯推薦】