IT貓撲網(wǎng):您身邊最放心的安全下載站! 最新更新|軟件分類|軟件專題|手機(jī)版|論壇轉(zhuǎn)貼|軟件發(fā)布

您當(dāng)前所在位置: 首頁服務(wù)器WEB服務(wù)器 → linux下apache配置文件詳解

linux下apache配置文件詳解

時(shí)間:2015-06-28 00:00:00 來源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評論(0)

  ### Section 1: Global Environment
  //當(dāng)服務(wù)器響應(yīng)主機(jī)頭(header)信息時(shí)顯示Apache的版本和操作系統(tǒng)名稱
  ServerTokens OS
  //設(shè)置服務(wù)器的根目錄
  ServerRoot "/etc/httpd"
  
  #ScoreBoardFile run/httpd.scoreboard
  
  //設(shè)置運(yùn)行Apache時(shí)使用的PidFile的路徑
  PidFile run/httpd.pid
  
  //若300秒后沒有收到或送出任何數(shù)據(jù)就切斷該連接
  Timeout 300
  
  //不使用保持連接的功能,即客戶一次請求連接只能響應(yīng)一個(gè)文件
  /建議用戶將此參數(shù)的值設(shè)置為On,即允許使用保持連接的功能
  KeepAlive Off
  
  //在使用保持連接功能時(shí),設(shè)置客戶一次請求連接能響應(yīng)文件的最大上限
  MaxKeepAliveRequests 100
  
  //在使用保持連接功能時(shí),兩個(gè)相鄰的連接的時(shí)間間隔超過15秒,就切斷連接
  KeepAliveTimeout 15
  
  ##
  ## Server-Pool Size Regulation (MPM specific)
  ##
  # prefork MPM
  # StartServers: number of server processes to start
  # MinSpareServers: minimum number of server processes which are kept spare
  # MaxSpareServers: maximum number of server processes which are kept spare
  # MaxClients: maximum number of server processes allowed to start
  # MaxRequestsPerChild: maximum number of requests a server process serves
  //設(shè)置使用Prefork MPM運(yùn)行方式的參數(shù),此運(yùn)行方式是Red hat默認(rèn)的方式
  
  
  //設(shè)置服務(wù)器啟動時(shí)運(yùn)行的進(jìn)程數(shù)
  StartServers 8
  
  //Apache在運(yùn)行時(shí)會根據(jù)負(fù)載的輕重自動調(diào)整空閑子進(jìn)程的數(shù)目
  //若存在低于5個(gè)空閑子進(jìn)程,就創(chuàng)建一個(gè)新的子進(jìn)程準(zhǔn)備為客戶提供服務(wù)
  MinSpareServers 5
  
  //若存在高于20個(gè)空閑子進(jìn)程,就創(chuàng)建逐一刪除子進(jìn)程來提高系統(tǒng)性能
  MaxSpareServers 20
  
  //限制同一時(shí)間的連接數(shù)不能超過150
  MaxClients 150
  
  //限制每個(gè)子進(jìn)程在結(jié)束處理請求之前能處理的連接請求為1000
  MaxRequestsPerChild 1000
  

  
  # worker MPM
  # StartServers: initial number of server processes to start
  //設(shè)置使用Worker MPM運(yùn)行方式的參數(shù)
  
  StartServers 2
  MaxClients 150
  MinSpareThreads 25
  MaxSpareThreads 75
  ThreadsPerChild 25
  MaxRequestsPerChild 0
  

  
  # perchild MPM
  # NumServers: constant number of server processes
  //設(shè)置使用perchild MPM運(yùn)行方式的參數(shù)
  
  NumServers 5
  StartThreads 5
  MinSpareThreads 5
  MaxSpareThreads 10
  MaxThreadsPerChild 20
  MaxRequestsPerChild 0
  

  
  //設(shè)置服務(wù)器的監(jiān)聽端口
  #Listen 12.34.56.78:80
  Listen 202.112.85.101:80
  
  #
  # Load config files from the config directory "/etc/httpd/conf.d".
  //將/etc/httpd/conf.d目錄下所有以conf結(jié)尾的配置文件包含進(jìn)來
  Include conf.dpublic_html>
  # AllowOverride FileInfo AuthConfig Limit
  # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  #
  # Order allow,deny
  # Allow from all
  #

  #
  # Order deny,allow
  # Deny from all
  #

  #
  
  //當(dāng)訪問服務(wù)器時(shí),依次查找頁面Index.html index.htm.var
  DirectoryIndex index.html index.html.var
  
  //指定保護(hù)目錄配置文件的名稱
  AccessFileName .htaccess
  
  //拒絕訪問以.ht開頭的文件,即保證.htaccess不被訪問
  
  Order allow,deny
  Deny from all
  

  
  //指定負(fù)責(zé)處理MIME對應(yīng)格式的配置文件的存放位置
  TypesConfig /etc/mime.types
  //指定默認(rèn)的MIME文件類型為純文本或HTML文件
  DefaultType text/plain
  
  //當(dāng)mod_mime_magic.c模塊被加載時(shí),指定magic信息碼配置文件的存放位置
  
  # MIMEMagicFile /usr/share/magic.mime
  MIMEMagicFile conf/magic
  

  
  //只記錄連接Apache服務(wù)器的Ip地址,而不紀(jì)錄主機(jī)名
  HostnameLookups Off
  //指定錯(cuò)誤日志存放位置
  ErrorLog logs/error_log
  //指定記錄的錯(cuò)誤信息的詳細(xì)等級為warn等級
  LogLevel warn
  //定義四中記錄日志的格式
  LogFormat "%h %l %u %t "%r" %>s %b "%{ Referer }i" "%{ User-Agent }i"" combined
  LogFormat "%h %l %u %t "%r" %>s %b" common
  LogFormat "%{ Referer }i -> %U" referer
  LogFormat "%{ User-agent }i" agent
  
  //指定訪問日志的紀(jì)錄格式為combined(混合型),并指定訪問日志存放位置
  # CustomLog logs/access_log common
  CustomLog logs/access_log combined
  #CustomLog logs/referer_log referer
  #CustomLog logs/agent_log agent
  #CustomLog logs/access_log combined
  
  //設(shè)置apache自己產(chǎn)生的頁面中使用apache服務(wù)器版本的簽名
  ServerSignature On
  
  //設(shè)置內(nèi)容協(xié)商目錄的訪問別名
  Alias /icons/ "/var/www/icons/"
  //設(shè)置/var/www/icons/的訪問權(quán)限
  
  //MultiViews 使用內(nèi)容協(xié)商功決定被發(fā)送的網(wǎng)頁的性質(zhì)
  Options Indexes MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
  

  
  //設(shè)置網(wǎng)頁郵件服務(wù)
  Alias /webmail "/usr/share/squirrelmail"
  
  
  Options Indexes MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
  

#p#副標(biāo)題#e#

  //設(shè)置apache手冊的訪問別名
  Alias /manual "/var/www/manual"
  
  
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
  

  //設(shè)置瀏覽器匹配
  BrowserMatch "Mozilla/2″ nokeepalive
  BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0
  BrowserMatch "RealPlayer 4.0″ force-response-1.0
  BrowserMatch "Java/1.0″ force-response-1.0
  BrowserMatch "JDK/1.0″ force-response-1.0
  BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
  BrowserMatch "^WebDrive" redirect-carefully
  
  #
  # Allow server status reports, with the URL of http://servername/server-s
  # Change the ".your-domain.com" to match your domain to enable.
  #
  #
  # SetHandler server-status
  # Order deny,allow
  # Deny from all
  # Allow from .your-domain.com
  #

  
  #
  # Allow remote server configuration reports, with the URL of
  # http://servername/server-i… (requires that mod_info.c be loaded).
  # Change the ".your-domain.com" to match your domain to enable.關(guān)鍵詞標(biāo)簽:linux,apache配置

相關(guān)閱讀

文章評論
發(fā)表評論

熱門文章 ISAPI Rewrite實(shí)現(xiàn)IIS圖片防盜鏈 ISAPI Rewrite實(shí)現(xiàn)IIS圖片防盜鏈 IIS6.0下配置MySQL+PHP5+Zend+phpMyAdmin IIS6.0下配置MySQL+PHP5+Zend+phpMyAdmin 在Windows服務(wù)器上快速架設(shè)視頻編解碼器全攻略 在Windows服務(wù)器上快速架設(shè)視頻編解碼器全攻略 win2000server IIS和tomcat5多站點(diǎn)配置 win2000server IIS和tomcat5多站點(diǎn)配置

相關(guān)下載

    人氣排行 XAMPP配置出現(xiàn)403錯(cuò)誤“Access forbidden!”的解決辦法 WIN2003 IIS6.0+PHP+ASP+MYSQL優(yōu)化配置 訪問網(wǎng)站403錯(cuò)誤 Forbidden解決方法 如何從最大用戶并發(fā)數(shù)推算出系統(tǒng)最大用戶數(shù) Server Application Unavailable的解決辦法 報(bào)錯(cuò)“HTTP/1.1 400 Bad Request”的處理方法 Windows Server 2003的Web接口 http 500內(nèi)部服務(wù)器錯(cuò)誤的解決辦法(windows xp + IIS5.0)