上接“Cacti和Zabbix所需Apache安装配置(一)”(http://rolandqu.blog.51cto.com/3477736/945717

6. httpd.conf 配置文件示例

  1. ServerRoot "/usr/local/apache" 
  2. Listen 80 
  3. LoadModule php5_module        modules/libphp5.so 
  4. <IfModule !mpm_netware_module> 
  5. <IfModule !mpm_winnt_module> 
  6. User daemon 
  7. Group daemon 
  8. </IfModule> 
  9. </IfModule> 
  10. ServerAdmin you@example.com 
  11. ServerName YourServerIpAddr:80 
  12. DocumentRoot "/usr/local/apache/htdocs/" 
  13. <Directory /> 
  14.     Options FollowSymLinks 
  15.     AllowOverride None 
  16.     Order deny,allow 
  17.     Deny from all 
  18. </Directory> 
  19. <Directory "/data/website/"> 
  20.     Options FollowSymLinks 
  21.     AllowOverride None 
  22.     Order allow,deny 
  23.     Allow from all 
  24. </Directory> 
  25. <IfModule dir_module> 
  26.     DirectoryIndex index.html index.shtml index.wml index.php index.jsp 
  27. </IfModule> 
  28. <FilesMatch "^\."> 
  29.     Order allow,deny 
  30.     Deny from all 
  31.     Satisfy All 
  32. </FilesMatch> 
  33. <Files ~ "\.inc$"> 
  34.    Order allow,deny 
  35.    Deny from all 
  36. </Files> 
  37. <Files ~ "\.log$"> 
  38.    Order allow,deny 
  39.    Deny from all 
  40. </Files> 
  41. <Files ~ "\.err$"> 
  42.    Order allow,deny 
  43.    Deny from all 
  44. </Files> 
  45. <Files ~ "\.conf$"> 
  46.    Order allow,deny 
  47.    Deny from all 
  48. </Files> 
  49. <Location /etc/> 
  50.    Order allow,deny 
  51.    Deny from all 
  52. </Location> 
  53. <Location /log/> 
  54.    Order allow,deny 
  55.    Deny from all 
  56. </Location> 
  57. ErrorLog "logs/error_log" 
  58. LogLevel warn 
  59. <IfModule log_config_module> 
  60.     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 
  61.     LogFormat "%h %l %u %t \"%r\" %>s %b" common 
  62.     <IfModule logio_module> 
  63.   LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio 
  64.     </IfModule> 
  65. </IfModule> 
  66. <IfModule alias_module> 
  67.     ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" 
  68. </IfModule> 
  69. <IfModule cgid_module> 
  70. </IfModule> 
  71. <Directory "/usr/local/apache/cgi-bin"> 
  72.     AllowOverride None 
  73.     Options None 
  74.     Order allow,deny 
  75.     Allow from all 
  76. </Directory> 
  77. DefaultType text/plain 
  78. <IfModule mime_module> 
  79.     TypesConfig conf/mime.types 
  80.     AddType application/x-compress .Z 
  81.     AddType application/x-gzip .gz .tgz 
  82.     AddType text/vnd.wap.wml wml 
  83.     AddType application/x-httpd-php .php 
  84.     AddType application/vnd.symbian.install .sis 
  85.     AddType application/octet-stream .sisx 
  86.     AddType application/octet-stream .cab 
  87.     AddType application/cab .cab 
  88.     AddType application/x-compress .cab 
  89.     AddType application/x-compressed .cab 
  90.     AddType zz-application/zz-winassoc-cab .cab 
  91.     AddType application/vnd.ms-cab-compressed .cab 
  92.     AddType application/java-archive .jar 
  93.     AddType text/vnd.sun.j2me.app-descriptor .jad 
  94. </IfModule> 
  95. Include conf/extra/httpd-mpm.conf 
  96. Include conf/vhosts.conf 
  97. <IfModule ssl_module> 
  98. SSLRandomSeed startup builtin 
  99. SSLRandomSeed connect builtin 
  100. </IfModule> 

7. 由于博文字数限制 httpd-mpm.conf  配置示例请参看“Cacti和Zabbix所需Apache安装配置(三)”(http://rolandqu.blog.51cto.com/3477736/945740

8. 由于博文字数限制 vhosts.conf 配置示例请参看“Cacti和Zabbix所需Apache安装配置(三)”(http://rolandqu.blog.51cto.com/3477736/945740