欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

apache 配置文件解說

 更新時間:2008年03月15日 18:44:56   作者:  
Apache為網(wǎng)絡管理員提供了豐富多彩的功能,包括目錄索引、目錄別名、內(nèi)容協(xié)商、可配置的HTTP錯誤報告、CGI程序的SetUID執(zhí)行、子進程資源管理、服務器端圖象映射、重寫URL、URL拼寫檢查以及聯(lián)機手冊man等。也就是說,如果您在Linux Server上成功安裝配置了Apache之后,您的計算機也將隨著Apache的生效而搖身一變,成為一臺名副其實的Web Server,這種變化的確是激動人心的。
 
在Internet時代,外部主頁的發(fā)布已經(jīng)成為樹立公司形象的一個重要手段,而內(nèi)部主頁也成為公司管理的主要方式。但是,要想實現(xiàn)這些功能,首先應該把我們的Linux Server配置成為一臺強大的Web Server。本章將詳細介紹如何配置Apache服務器。希望各位同仁能夠通過閱讀本片文章達到理論實踐雙豐收的目的,在很短的時間里迅速成為一名出色的網(wǎng)絡管理員。 
1.2 所需資源 
1.2.1 所需包 
RedHat6.2 服務器安裝 
1.2.2 所需配置文件 
/etc/httpd/conf/httpd.conf 系統(tǒng)自帶,管理員配置 
/etc/httpd/conf/access.conf 系統(tǒng)自帶,不需要修改 
/etc/httpd/conf/srm.conf 系統(tǒng)自帶,不需要修改 

1.3 配置方案 
/etc/httpd/conf/httpd.conf 
說明:apache主配置文件 
源文件: 
ServerType standalone 
   #定義WebServer的啟動方式為standalone,以增強其對大量訪問的及時響應性 
ServerRoot "/etc/httpd" 
   #指定包含httpd服務器文件的目錄 
LockFile /var/lock/httpd.lock 
PidFile /var/run/httpd.pid 
ScoreBoardFile /var/run/httpd.scoreboard 
Timeout 300 
  ?。m憫瑫r量,單位為秒 
KeepAlive On 
  ?。T试S用戶建立永久連接 
MaxKeepAliveRequests 100 
KeepAliveTimeout 15 
MinSpareServers 5 
   #要保留的空閑服務器進程的最小值 
MaxSpareServers 20 
  ?。RA舻目臻e服務器進程的最大值 
StartServers 8 
  ?。O到y(tǒng)啟動時的守護進程數(shù) 
MaxClients 150 
  ?。K芴峁┓盏淖畲罂蛻舳司幪?,大于它的部分被放入請求隊列 
MaxRequestsPerChild 100 
LoadModule vhost_alias_module modules/mod_vhost_alias.so 
LoadModule env_module     modules/mod_env.so 
LoadModule config_log_module modules/mod_log_config.so 
LoadModule agent_log_module  modules/mod_log_agent.so 
LoadModule referer_log_module modules/mod_log_referer.so 
LoadModule mime_module    modules/mod_mime.so 
LoadModule negotiation_module modules/mod_negotiation.so 
LoadModule status_module   modules/mod_status.so 
LoadModule info_module    modules/mod_info.so 
LoadModule includes_module  modules/mod_include.so 
LoadModule autoindex_module  modules/mod_autoindex.so 
LoadModule dir_module     modules/mod_dir.so 
LoadModule cgi_module     modules/mod_cgi.so 
LoadModule asis_module    modules/mod_asis.so 
LoadModule imap_module    modules/mod_imap.so 
LoadModule action_module   modules/mod_actions.so 
LoadModule userdir_module   modules/mod_userdir.so 
LoadModule alias_module    modules/mod_alias.so 
LoadModule rewrite_module   modules/mod_rewrite.so 
LoadModule access_module   modules/mod_access.so 
LoadModule auth_module    modules/mod_auth.so 
LoadModule anon_auth_module  modules/mod_auth_anon.so 
LoadModule db_auth_module   modules/mod_auth_db.so 
LoadModule digest_module   modules/mod_digest.so 
LoadModule proxy_module    modules/libproxy.so 
LoadModule expires_module   modules/mod_expires.so 
LoadModule headers_module   modules/mod_headers.so 
LoadModule usertrack_module  modules/mod_usertrack.so 
LoadModule setenvif_module  modules/mod_setenvif.so 
LoadModule perl_module    modules/libperl.so 
LoadModule php3_module    modules/libphp3.so 
ClearModuleList 
AddModule mod_vhost_alias.c 
AddModule mod_env.c 
AddModule mod_log_config.c 
AddModule mod_log_agent.c 
AddModule mod_log_referer.c 
AddModule mod_mime.c 
AddModule mod_negotiation.c 
AddModule mod_status.c 
AddModule mod_info.c 
AddModule mod_include.c 
AddModule mod_autoindex.c 
AddModule mod_dir.c 
AddModule mod_cgi.c 
AddModule mod_asis.c 
AddModule mod_imap.c 
AddModule mod_actions.c 
#AddModule mod_speling.c 
AddModule mod_userdir.c 
AddModule mod_alias.c 
AddModule mod_rewrite.c 
AddModule mod_access.c 
AddModule mod_auth.c 
AddModule mod_auth_anon.c 
AddModule mod_auth_db.c 
AddModule mod_digest.c 
AddModule mod_proxy.c 
AddModule mod_expires.c 
AddModule mod_headers.c 
AddModule mod_usertrack.c 
AddModule mod_so.c 
AddModule mod_setenvif.c 
AddModule mod_perl.c 
AddModule mod_php3.c 
Port 80 
   #定義服務器所使用的TCP的端口號 
User nobody 
Group nobody 
  ?。R陨蟽尚惺欠峙浣ohttpd的新用戶的文件權(quán)限,出于安全的考慮把 
   它們的權(quán)限設置成為最低。 
ServerAdmin 
  ?。TO置Web管理員的郵件地址 
ServerName WebOA 
  ?。6x客戶端從服務器讀取數(shù)據(jù)時返回給客戶端的主機名,其缺省值 
   是localhost,第一次安裝Linux的時候經(jīng)常這里出錯。 
DocumentRoot "/home/weboa/jakarta-tomcat/webapps/weboa" 
  ?。TO置所有Apache文檔的根目錄,比如說,用戶對 
   的訪問請求,Apache對它 
   的響應是/home/weboa/jakarta-tomcat/webapps/weboa/index.html 
   Options FollowSymLinks 
   AllowOverride None 

   Options Indexes Includes FollowSymLinks 
   AllowOverride None 
   Order allow,deny 
   Allow from all      # 允許所有人訪問 
UserDir public_html 
DirectoryIndex index.html index.htm index.shtml index.cgi 
  ?。TO置多種成功訪問主頁的方式,為的是提高系統(tǒng)的容錯性 
AccessFileName .htaccess 
   Order allow,deny 
   Deny from all 
UseCanonicalName On 
TypesConfig /etc/mime.types 
DefaultType text/plain 
   MIMEMagicFile share/magic 
HostnameLookups Off 
ErrorLog /usr/httpd/log/error_log 
LogLevel warn 
  ?。6x那些錯誤類型被記錄到錯誤日志中 
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 
  ?。K械腖ogFormat都用來定義日志中的條目 
LogFormat "%h %l %u %t \"%r\" %>s %b" common 
LogFormat "%{Referer}i -> %U" referer 
LogFormat "%{User-agent}i" agent 
CustomLog /usr/httpd/log/access_log common 
ServerSignature On 
Alias /icons/ "/home/httpd/icons/" 
#定義目錄與系統(tǒng)目錄的對應關(guān)系 
   Options Indexes MultiViews 
   AllowOverride None 
   Order allow,deny 
   Allow from all 
ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/" 
#定義CGI目錄 
   AllowOverride None 
   Options ExecCGI 
   Order allow,deny 
   Allow from all 
IndexOptions FancyIndexing 
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip 
AddIconByType (TXT,/icons/text.gif) text/* 
AddIconByType (IMG,/icons/image2.gif) image/* 
AddIconByType (SND,/icons/sound2.gif) audio/* 
AddIconByType (VID,/icons/movie.gif) video/* 
AddIcon /icons/binary.gif .bin .exe 
AddIcon /icons/binhex.gif .hqx 
AddIcon /icons/tar.gif .tar 
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv 
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip 
AddIcon /icons/a.gif .ps .ai .eps 
AddIcon /icons/layout.gif .html .shtml .htm .pdf 
AddIcon /icons/text.gif .txt 
AddIcon /icons/c.gif .c 
AddIcon /icons/p.gif .pl .py 
AddIcon /icons/f.gif .for 
AddIcon /icons/dvi.gif .dvi 
AddIcon /icons/uuencoded.gif .uu 
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl 
AddIcon /icons/tex.gif .tex 
AddIcon /icons/bomb.gif core 
AddIcon /icons/back.gif .. 
AddIcon /icons/hand.right.gif README 
AddIcon /icons/folder.gif ^^DIRECTORY^^ 
AddIcon /icons/blank.gif ^^BLANKICON^^ 
DefaultIcon /icons/unknown.gif 
ReadmeName README 
HeaderName HEADER 
AddEncoding x-compress Z 
AddEncoding x-gzip gz tgz 
AddLanguage en .en 
AddLanguage fr .fr 
AddLanguage de .de 
AddLanguage da .da 
AddLanguage el .el 
AddLanguage it .it 
LanguagePriority en fr de 
   AddType application/x-httpd-php3 .php3 
   AddType application/x-httpd-php3-source .phps 

   AddType application/x-httpd-php .phtml 
AddType application/x-tar .tgz 
AddType text/html .shtml 
AddHandler server-parsed .shtml 
AddHandler imap-file map 
BrowserMatch "RealPlayer 4\.0" force-response-1.0 
BrowserMatch "Java/1\.0" force-response-1.0 
BrowserMatch "JDK/1\.0" force-response-1.0 
   Alias /perl/ /home/httpd/perl/ 
   SetHandler perl-script 
   PerlHandler Apache::Registry 
   Options +ExecCGI 

Alias /doc/ /usr/doc/ 
   order deny,allow 
   deny from all 
   allow from localhost 
   Options Indexes FollowSymLinks 
include /etc/httpd/conf/tomcat-apache.conf 
Alias /netcard "/home/weboa/jakarta-tomcat/webapps/weboa/net_card" 
   Options Indexes FollowSymLinks 
   allow from all 
CacheSize 5 
#定義緩存區(qū)大小,以KB為單位。可以根據(jù)需要和硬盤空間大小進行設置 
CacheGcInterval 4 
#每隔4小時檢查緩存區(qū),如果已經(jīng)超過CacheSize就刪除文件 
CacheMaxExpire 24 
#HTTP文件最多被保持24小時 
CacheLastModifiedFactor 0.1 
#定義HTTP文件失效期,缺省是0.1 ,意思是說失效期=離最近一次修改的時間X,比如離最近一次修改的時間是5小時,那么失效期就是5X0.1=0.5小時 
CacheDefaultExpire 1 
#這一指令提供一個缺省的時間(小時)來銷毀緩存的文件,這些文件的最后更改時間不詳。CacheMaxExpire 命令不覆蓋這一設置 
## 以下是如何對一個目錄進行登陸控制的方法 ## 在/etc/httpd/conf/httpd.conf中添加以下內(nèi)容: 
Alias /weboa/ "/home/weboa/" 
   Options Indexes MultiViews 
   AllowOverride authconfig 
   Order allow,deny 
   Allow from all 
在/home/weboa目錄下建立.htaccess文件 
   authname "shared files" 
   authtype basic 
   authuserfile /etc/httpd/conf/passwd 
require valid-user 
在/etc/httpd/conf目錄下執(zhí)行命令生成認證文件 
htpasswd -c thj thj #創(chuàng)建認證文件和第一個名和密碼 
htpasswd weboa weboa #添加其他用戶名和密碼 

### 以下是做的實現(xiàn)方法 ### 
需要在/etc/httpd/conf/httpd.conf中添加下列內(nèi)容: 
Alias /webadmin/ "/home/weboa/webadmin/html/" 
   Options Indexes MultiViews 
   AllowOverride None 
   Order allow,deny 
   Allow from all 
NameVirtualHost 192.168.0.1 #虛擬域名的DNS服務器 
ServerAdmin #網(wǎng)管郵件地址 
DocumentRoot /home/weboa/webadmin/html/ #服務器頁面目錄 
ServerName webadmin.weboa.com.cn #服務器名稱 
需要在/var/named/name2ip.conf中添加的內(nèi)容: 
webadmin   IN   A   192.168.0.1 

1.4 測試及管理辦法 
1.4.1 測試方法 
每當管理員更改了Apache的設置之后,都應執(zhí)行 /etc/rc.d/init.d/httpd restart使得更改生效。 
1.4.2 管理方法 
Apache提供大量的日志文件,當Apache出錯的時候,管理員可以根據(jù)htppd.conf中的ErrorLog定義的路徑來診斷。具體方法是: 
tail -f /var/log/httpd/apache/error_log 
(作者:湯海京)

相關(guān)文章

最新評論