apache 部份参数说明 [转帖]

由 北南南北 在 09-04-2002 17:14 发表:

apache 部份参数说明 [转帖]

apache 部份参数说明

AllowOverride 的属性功能

AllowOverride Limit 允许盖掉原联结属性得范围

AllowOverride Authconfig 可做密码设定:如:藏密

AllowOverride Options 可将该目录之Options 功能覆盖

AllowOverride FileInfo 可将该目录之任何文件型态覆盖,如:DefaultType,ErrorType

AllowOverride Indexs 可将该目录之显式打印功能覆盖,如:AddIcon,HeaderName.ReadName

Options的属性功能

Indexs 当无index.html可用打印目录方式显式,如:center3 homepage 若用 -Indexs 则看不见 listing

FollowSymLinks 加一属性如+FollowSymLinks可允许使用symbol link 时,依旧可浏览

ExecCGI 当为 +ExecCGI可执行 CGI SCRIPT

Includes 可执行Server site include,若为 +Includes

IncludesNOEXEC 可执行Server site include,若为 +Includes,但不可执行CGI

None 没有任何功能可用

All 均可

总之,以 +, - 符号可加或删减其功能,若未给符号,则只有初步功能

Limit的属性功能

GET 限定取得文件法,如:

  1<limit get="">   
  2  
  3POST 限定cgi post方法,如:<limit post="">   
  4  
  5order 限定拒绝或允许的次序   
  6  
  7deny 限定拒绝范围,如:deny from all 或 deny from .mycompany.com   
  8  
  9allow 限定允许范围,如:allow from all 或 allow from 192.153.22   
 10  
 11  
 12  
 13AuthConfig 之方法 &amp; .htaccess 范例   
 14  
 15  
 16  
 17<files index.html="">   
 18  
 19#与Directory同,但在 .htaccess 只能用他 AuthName Members-only 设定仅 Member 才可入,仅为名称 AuthType Basic 译码方法   
 20  
 21  
 22  
 23AuthUserFile /home1/users/center/center21/public_html/wwwclass/bau   
 24  
 25#密码表位置(绝对位置) AuthGroupFile /home1/users/center/center21/public_html/wwwclass/group   
 26  
 27#同群表位置   
 28  
 29<limit get="">   
 30  
 31#限制取件   
 32  
 33require user center21   
 34  
 35#bau的密码表有很多user,但....   
 36  
 37order allow,deny   
 38  
 39#先允许在拒绝   
 40  
 41allow from all   
 42  
 43#允许全部   
 44  
 45</limit>
 46<files>   
 47  
 48  
 49  
 50密码表之产生方法   
 51  
 52  
 53  
 54找到及取得htpasswd程序   
 55  
 56执行htpasswd -c filename username (第一次,以后仅htpasswd filename username)   
 57  
 58修改需要的 user (在 require 后)   
 59  
 60  
 61  
 62require用法   
 63  
 64  
 65  
 66require user center21 center3   
 67  
 68require group cc cv ee   
 69  
 70  
 71  
 72语法:ServerType [standalone/inted]   
 73  
 74# 说明:定义 httpd 的激活方式   
 75  
 76# standalone:开机后立即执行,效率较高,http独立执行,即使没有浏览者连入本网站,   
 77  
 78  
 79  
 80都会激活httpd以随畤提供服务。   
 81  
 82  
 83  
 84# inted:需要时才临时激活,监听所有进入本机请求的port,然后核对port所对应的服务   
 85  
 86  
 87  
 88以决定要用哪一个服务,再执行httpd,当请求完结就将httpd结束。   
 89  
 90  
 91  
 92  
 93  
 94  
 95  
 96# 语法:Port [编号]   
 97  
 98# 说明:指定 httpd 服务的网关,一般是 80,   
 99  
100# 2000 以后的 URL 就必须写成 http://xx.xx.xx.xx:2000/   
101  
102  
103  
104  
105  
106# 语法:HostNameLookups [on/off]   
107  
108# 说明:设定要不要把自动搜寻 HostName 的功能打开   
109  
110# 设定为on时,则会记录进入此网站使用者的主机名称(例如fo23.flag.com.tw)   
111  
112  
113  
114# 设为off,则仅记录使用者主机的IP(例如203.74.205.23)   
115  
116  
117  
118  
119  
120  
121  
122# 语法:User [username/#uid]   
123  
124# 说明:设定 httpd 这程序的执行者是谁.   
125  
126# 一般是 nobody,也可以是已注册的 user,若用 user id 要加上 # 号   
127  
128  
129  
130  
131  
132# 语法:Group [groupname/#gid]   
133  
134# 说明:设定 httpd 这程序的执行者所属的群组   
135  
136# 一般是 nogroup,此 group 必须要存在于 /etc/group 中   
137  
138  
139  
140  
141  
142# 语法:Server Admin [E-mail 地址]   
143  
144# 说明:设定此 web 站管理者的 E-mail地址,在系统发生错误时,方便与管理者联络   
145  
146  
147  
148  
149  
150# 语法:ServerRoot [目录的绝对路径]   
151  
152# 说明:设定 apache 所安装的绝对路径,所有网站相关的裆案都存放在此目录中   
153  
154# 举例:ServerRoot /usr/local/apache   
155  
156  
157  
158  
159  
160  
161  
162# 语法:BindAddress [*/IP/FQDN]   
163  
164# 说明:强迫 apache 只对某个特定地址反应, * 则是对所有地址都反应   
165  
166# 如果要采用 Virtual Host 虚拟主机功能,务必要设为 BindAddress *   
167  
168# 说明:设定要以哪一个 address 来服务,可使用 IP 或完整的主机名称(FQDN),   
169  
170# * 是全部接受   
171  
172  
173  
174# 当使用虚拟主机功能畤,一台计算机上可能有几张网络卡分别设定不同的IP。BindAddress   
175  
176  
177  
178设为*,表示系统会监听每一个IP的联机;设为IP值,则仅监听该IP的联机;亦可设定为   
179  
180  
181  
182domain name,仅监听来自该处的联机   
183  
184  
185  
186  
187  
188  
189  
190# 语法:ErrorLog [文件名称]   
191  
192# 说明:记录执行 apache 时所产生的错误讯息,如果文件名不是以 / 开头,那就不会连   
193  
194# 接到 ServerRoot 的路径下   
195  
196# 举例:ErrorLog logs/error_log   
197  
198# 将错误讯息放在 /usr/local/apache/logs/error_log 中   
199  
200# apache 的 root directory 在 /usr/local/apache   
201  
202  
203  
204  
205  
206  
207  
208# 语法:LogLevel [debug/info/notice/warm/error/crit/alert/emerg]   
209  
210# 说明:设定 error_log 中记录的错误讯息种类,建议值是 warm,越右边越简略   
211  
212  
213  
214  
215  
216# 语法:CustomLog [文件名称][combined/common/referer/agent]   
217  
218# 说明:同 ErrorLog 部份 ,是属于传输记录,并起设定该记录所记录的信息   
219  
220# 举例:CustomLog logs/access_log common (common 是建议值)   
221  
222# 越右边的参数越简略   
223  
224# 若 user 多时,此档会变很大,要小心管理   
225  
226  
227  
228# LogFormat "%h %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined   
229  
230  
231  
232# LogFormat "%h %l %u %t \"%r\" %&gt;s %b" common   
233  
234  
235  
236# LogFormat"%{Referer}@-&gt;%U"referel   
237  
238  
239  
240# LogFormat”%{User-agent}i"agent   
241  
242  
243  
244# 设定每笔记录的楁式,有 combined、common、referer与 agent四种   
245  
246  
247  
248# The location of the access logfile (Common Logfile Format)   
249  
250  
251  
252# If this does not start with /, ServerRoot is prepended to it.   
253  
254  
255  
256# CustomLog/usr/local/apacHe/Var/log/access_log common   
257  
258  
259  
260# 存取记录的位置,使用Comon格式   
261  
262  
263  
264# If you would like to have an agent and referer logfile uncomment the   
265  
266  
267  
268# following directives.   
269  
270  
271  
272# CustomLog/usr/local/apache/var/log/referer_logreferel   
273  
274  
275  
276# 记录浏览者经由本网站所连结出丢的网址,使用refere「自订格式   
277  
278  
279  
280# CustomLog/usr/local/apache/var/log/agent_logagent   
281  
282  
283  
284# 记录浏览者连到本网站所使用的浏览器版本与种类,使用agent自订格式   
285  
286  
287  
288# If you prefer a single logfile with access, agent and referer information   
289  
290  
291  
292# (Combined Logfile Format) you can use the following directive.   
293  
294  
295  
296# CustomLog /usr/local/apache/var/log/access_log combined   
297  
298  
299  
300  
301  
302  
303  
304# 语法:PidFile [pid-filename]   
305  
306# 说明:记录 httpd 激活时的 PID,以方便管理员的管理;方便重新激活时做参考,   
307  
308# 这样就不必用 ps 来寻找   
309  
310# 举例:PidFile logs/httpd.pid   
311  
312  
313  
314# PidFile /usr/local/apache/var/run/httpd.pid ←纪录httpd的 PID   
315  
316  
317  
318  
319  
320  
321  
322# 语法:ScoreBoardFile [文件名称]   
323  
324# 说明:纪录被使用过的档案   
325  
326# 举例:ScoreBoardFile logs/apache_runtime_status   
327  
328  
329  
330  
331  
332  
333  
334# 语法:ServerName [主机名称]   
335  
336# 说明:设定该服务器的 Domain Name ,此名称必须是已经向贵网域的 DNS 注册。   
337  
338# 举例:ServerName http://www.hmes.kh.edu.tw ← 若没有一个登记的DNS name,则请改为IP   
339  
340  
341  
342  
343  
344  
345  
346# 语法:CacheNegotiatedDocs   
347  
348  
349  
350# 说明:当使用者藉 Proxy 来读取 Web Server 时,Apache Httpd 会送出 Pragma:   
351  
352  
353  
354# no-cache 的档头使得 Proxy Server 不会把他留在 cache 中。   
355  
356  
357  
358  
359  
360  
361  
362# 语法:Timeout [秒数]   
363  
364  
365  
366# 说明:设定 httpd 等待使用者下一个指令的时间,如果在此时间内使用者没有响应   
367  
368  
369  
370# ,则终止服务,如果网络速度慢,时间设长一些。   
371  
372  
373  
374# 举例:Timeout 300   
375  
376  
377  
378  
379  
380  
381  
382# 语法:KeepAlive [on/off]   
383  
384# 说明:设定是否接受使用者之连续请求。   
385  
386  
387  
388  
389  
390  
391  
392# 语法:MaxKeepAliveRequests [数目]   
393  
394# 说明:设定能接受之最大连续请求量,如果连续请求超过此数量, server 会自动踢掉。   
395  
396# 举例:MaxKeepAliveRequests 100 ←每次联机可提出要求数量,设为0表示不限次数,顸设为100   
397  
398  
399  
400  
401  
402  
403  
404# 语法:KeepAliveTimeout [秒数]   
405  
406# 说明:设定使用者连续请求等待的时间上限,如果 user 连续请求的时间超过此数,则   
407  
408# 不再执行此请求   
409  
410# 举例:KeepAliveTimeou 15 ←下个要求如果超过多少秒还未到达,则视为联机结束   
411  
412  
413  
414  
415  
416  
417  
418  
419  
420# 语法:MaxSpareServers [数量]   
421  
422# MinSpareServers [数量]   
423  
424# 说明:设定闲置来等待服务的服务器数量,当系统的闲置个数小于此设定时,系统会开   
425  
426# 启更多的 server 来服务;当系统的闲置个数大于此设定时,多余的个数会被删   
427  
428# 掉;如果 web 使用率高,应加大 MinSpareServers   
429  
430# 举例:MaxSpareServers 10 MinSpareServers 5   
431  
432  
433  
434  
435  
436  
437  
438# 语法:StartServers [数量]   
439  
440# 说明:一开始驱动 apache httpd 时,闲置等待服务的服务器数量   
441  
442# 举例:StartServers 5 ←(执行ps-aux指令就可以看到这5个serverprocesses)   
443  
444  
445  
446  
447  
448  
449  
450# 语法:MaxClients [数量]   
451  
452# 说明:设定最多能提供给几个 user 同时联机   
453  
454# 举例:MaxClients 150 ←因为同时连进来的数目大多时,会降低系统存取的效能,可设   
455  
456  
457  
458定此数值限制同时联机进来的数目,若您的系统CPU很快、内存很多且效能很   
459  
460  
461  
462好时,可以考虑将此值调高.否则就降低一点   
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474# 语法:MaxRequestsPerChild [数量]   
475  
476# 说明:设定每个子程序所能接受的最大服务次数,当达到此数目时,子程序会自动关闭   
477  
478# 举例:MaxRequestsPerChild 30   
479  
480  
481  
482  
483  
484  
485  
486  
487  
488# 语法:ProxyRequests [On/Off]   
489  
490  
491  
492# 说明:开启或关闭 Proxy 的功能,内定值是关闭,大部份情况也是关闭。用标准安装时,   
493  
494  
495  
496Apache并没有将 proxy 模块加入,若需要此功能,请参考INSTALLS文件的誽明。   
497  
498  
499  
500  
501  
502  
503  
504# 语法:<virtualhost [hostname]="">..</virtualhost>   
505  
506# 说明:虚拟主机的设定;在做此设定之前,必须有支持 multipule address 或有一片   
507  
508# 以上的网络卡   
509  
510  
511  
512# 举例:   
513  
514# NameVirtualHost 203.72.230.212 ## 一定要设,apache 1.3以上才有的改变   
515  
516#   
517  
518# <virtualhost wwwa.hmes.kh.edu.tw=""> ## 第一部份   
519  
520  
521  
522  
523  
524# ServerAdmin [email protected]   
525  
526  
527  
528# 设定虚拟主机的管理者信箱,不一定要和本机的网站管理者相同   
529  
530  
531  
532  
533  
534# DocumentRoot /www/docs/   
535  
536# 指定虚拟主机的网站主目录   
537  
538  
539  
540  
541  
542# ServerName wwwa.hmes.kh.edu.tw ##设为 VirtualHost 的名称   
543  
544# 指定虚拟主机的URL   
545  
546  
547  
548  
549  
550# ErrorLog logs/?? ??   
551  
552  
553  
554# 虚拟主机发生错误时要记录在哪个目录   
555  
556  
557  
558  
559  
560# TransferLog logs/??   
561  
562  
563  
564# 虚拟主机存取记钱要存放的目录   
565  
566  
567  
568  
569  
570# </virtualhost>   
571  
572  
573  
574# <virtualhost wwwb.hmes.kh.edu.tw=""> ##第二个 DNS ## 第二部份   
575  
576# ServerAdmin [email protected]   
577  
578# DocumentRoot /www/docs2/   
579  
580  
581  
582# ServerName wwwb.hmes.kh.edu.tw   
583  
584  
585  
586# ErrorLog logs/??   
587  
588# TransferLog logs/??   
589  
590# </virtualhost>   
591  
592  
593  
594  
595  
596  
597  
598# 语法:DocumentRoot [目录名称]   
599  
600# 说明:设定在没有特定指定文件安装目录的情况下,服务器的文件安装的目录;   
601  
602# 也就是 httpd.conf 尚未设定 VirtualHost 时,他人直接用 http 与 server   
603  
604# 联机时,服务器要输出的资料所放的位置   
605  
606# 举例:DocumentRoot /usr/local/apache/share/htdocs   
607  
608  
609  
610  
611  
612  
613  
614# 语法:UseDir [目录名称]   
615  
616# 说明:若有提供给 user 放置个人首页时,必须将自己的首页放置在自己的目录中,   
617  
618# 当其它人浏览时,只要以 http://xxx.xxx.xxx.xxx/~username 就可以浏览   
619  
620# 个人网页   
621  
622# 举例:UserDir Public_html   
623  
624  
625  
626  
627  
628  
629  
630# 语法:DirectoryIndex [文件名1][文件名2]   
631  
632# 说明:设定使用者连入网站时,在不指定浏览档案的情况下,第一个浏览的文件名称。   
633  
634# 通常是使用者所看到的第一页资料   
635  
636# 举例:DirectoryIndex index.htm index.html   
637  
638  
639  
640  
641  
642  
643  
644# 语法:FancyIndexing [on/off]   
645  
646# 说明:如果找不到 DirectoryIbdex 所指定的档案时,要不要把该目录资料转换成   
647  
648# html 格式呈现出来。呈现方式要参考 access.conf 中 <directory ..=""> ..   
649  
650# </directory>,可以用 IndexOptions 来设定。   
651  
652  
653  
654# 举例:Fancyindexing on ←从浏览器中显示网站目录的档案列表时(例如找不到index.htm档时   
655  
656  
657  
658就会出现档案列表),此值设为on,则会包括档案类型的小图标,   
659  
660  
661  
662看起来比较漂亮;若设为off,则仅单纯地列出文件名,小图标都放   
663  
664  
665  
666在 /usr/local/apache/icons目录中   
667  
668  
669  
670  
671  
672# 语法:AddIconByEncoding [图形文件位置][MIME-encoding 方式]   
673  
674# 说明:当 FancyIndexing 为 on ,且必须列出目录信息时,会根据所列出档案的   
675  
676# MIME-encoding 格式在文件名前面加上特定的图形文件作为卷标以供辨识。   
677  
678# 举例:AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip   
679  
680  
681  
682  
683  
684  
685  
686# 语法:AddIconByType [图形文件位置] [MIME-Type 种类]   
687  
688# 说明:当 FancyIndexing 为 on ,且必须列出目录信息时,会根据所列出档案的   
689  
690# MIME-Type 在文件名前面加上特定的图形文件作为卷标以供辨识。   
691  
692# 举例:AddIconByType (TXT,/icons/text.gif) text/   
693  
694  
695  
696  
697  
698  
699  
700# 语法:AddIcon [图形文件位置] [MIME-Type 种类]   
701  
702# 说明:当 FancyIndexing 为 on ,且必须列出目录信息时,会根据所列出档案的   
703  
704# 扩展名,在档名前面加上特定的图形文件作为卷标以供辨识。   
705  
706# 举例:AddIcon /icons/binary.gif .bin .exe   
707  
708  
709  
710  
711  
712  
713  
714# 语法:DefaultIcon [图形文件位置]   
715  
716# 说明:当 FancyIndexing 为 on ,且必须列出目录信息时,如果档案无法分辨其   
717  
718# 格式或是类型,在档名前面所要加上的图形。   
719  
720# 举例:DefaultIcon /icons/unknown.gif</files></files></limit></limit>
Published At
Categories with 服务器类
Tagged with
comments powered by Disqus