IT你好

加入 |登录

IT你好技术论坛广场各种系统Linux › 查看主题

127

查看

4

回复
返回列表

Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20

帖子
1135 
精华
144 
积分
8341 
UID
go

APache配置笔记-it你好原创-本文不定期更新中

1
发表于 2011-4-15 13:48 | 只看该作者 | 倒序看帖 | 打印
  1. #
  2. # This is the main Apache server configuration file.  It contains the
  3. # configuration directives that give the server its instructions.
  4. # See http://httpd.apache.org/docs/2.2/; for detailed information.
  5. # In particular, see
  6. # http://httpd.apache.org/docs/2.2/mod/directives.html;
  7. # for a discussion of each configuration directive.
  8. #
  9. #
  10. # Do NOT simply read the instructions in here without understanding
  11. # what they do.  They're here only as hints or reminders.  If you are unsure
  12. # consult the online docs. You have been warned.  
  13. #
  14. # The configuration directives are grouped into three basic sections:
  15. #  1. Directives that control the operation of the Apache server process as a
  16. #     whole (the 'global environment').
  17. #  2. Directives that define the parameters of the 'main' or 'default' server,
  18. #     which responds to requests that aren't handled by a virtual host.
  19. #     These directives also provide default values for the settings
  20. #     of all virtual hosts.
  21. #  3. Settings for virtual hosts, which allow Web requests to be sent to
  22. #     different IP addresses or hostnames and have them handled by the
  23. #     same Apache server process.
  24. #
  25. # Configuration and logfile names: If the filenames you specify for many
  26. # of the server's control files begin with "/" (or "drive:/" for Win32), the
  27. # server will use that explicit path.  If the filenames do *not* begin
  28. # with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
  29. # with ServerRoot set to "/etc/httpd" will be interpreted by the
  30. # server as "/etc/httpd/logs/foo.log".
  31. #
  32. ### Section 1: Global Environment
  33. #
  34. # The directives in this section affect the overall operation of Apache,
  35. # such as the number of concurrent requests it can handle or where it
  36. # can find its configuration files.
  37. #
  38. #
  39. #
  40. # Don't give away too much information about all the subcomponents
  41. # we are running.  Comment out this line if you don't mind remote sites
  42. # finding out what major optional modules you are running
  43. ServerTokens OS
  44. #
  45. # ServerRoot: The top of the directory tree under which the server's
  46. # configuration, error, and log files are kept.
  47. #
  48. # NOTE!  If you intend to place this on an NFS (or otherwise network)
  49. # mounted filesystem then please read the LockFile documentation
  50. # (available at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>;);
  51. # you will save yourself a lot of trouble.
  52. #
  53. # Do NOT add a slash at the end of the directory path.
  54. #
  55. ServerRoot "/etc/httpd"
  56. #
  57. # PidFile: The file in which the server should record its process
  58. # identification number when it starts.
  59. #
  60. PidFile run/httpd.pid
  61. #
  62. # Timeout: The number of seconds before receives and sends time out.
  63. #
  64. Timeout 120
  65. #
  66. # KeepAlive: Whether or not to allow persistent connections (more than
  67. # one request per connection). Set to "Off" to deactivate.
  68. #
  69. KeepAlive Off
  70. #
  71. # MaxKeepAliveRequests: The maximum number of requests to allow
  72. # during a persistent connection. Set to 0 to allow an unlimited amount.
  73. # We recommend you leave this number high, for maximum performance.
  74. #
  75. MaxKeepAliveRequests 100
  76. #
  77. # KeepAliveTimeout: Number of seconds to wait for the next request from the
  78. # same client on the same connection.
  79. #
  80. KeepAliveTimeout 15
  81. ##
  82. ## Server-Pool Size Regulation (MPM specific)
  83. ##
  84. # prefork MPM
  85. # StartServers: number of server processes to start
  86. # MinSpareServers: minimum number of server processes which are kept spare
  87. # MaxSpareServers: maximum number of server processes which are kept spare
  88. # ServerLimit: maximum value for MaxClients for the lifetime of the server
  89. # MaxClients: maximum number of server processes allowed to start
  90. # MaxRequestsPerChild: maximum number of requests a server process serves
  91. <IfModule prefork.c>
  92. StartServers       8
  93. MinSpareServers    5
  94. MaxSpareServers   20
  95. ServerLimit      256
  96. MaxClients       256
  97. MaxRequestsPerChild  4000
  98. </IfModule>
  99. # worker MPM
  100. # StartServers: initial number of server processes to start
  101. # MaxClients: maximum number of simultaneous client connections
  102. # MinSpareThreads: minimum number of worker threads which are kept spare
  103. # MaxSpareThreads: maximum number of worker threads which are kept spare
  104. # ThreadsPerChild: constant number of worker threads in each server process
  105. # MaxRequestsPerChild: maximum number of requests a server process serves
  106. <IfModule worker.c>
  107. StartServers         2
  108. MaxClients         150
  109. MinSpareThreads     25
  110. MaxSpareThreads     75
  111. ThreadsPerChild     25
  112. MaxRequestsPerChild  0
  113. </IfModule>
  114. #
  115. # Listen: Allows you to bind Apache to specific IP addresses and/or
  116. # ports, in addition to the default. See also the <VirtualHost>
  117. # directive.
  118. #
  119. # Change this to Listen on specific IP addresses as shown below to
  120. # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
  121. #
  122. #Listen 12.34.56.78:80
  123. Listen 80
  124. #
  125. # Dynamic Shared Object (DSO) Support
  126. #
  127. # To be able to use the functionality of a module which was built as a DSO you
  128. # have to place corresponding `LoadModule' lines at this location so the
  129. # directives contained in it are actually available _before_ they are used.
  130. # Statically compiled modules (those listed by `httpd -l') do not need
  131. # to be loaded here.
  132. #
  133. # Example:
  134. # LoadModule foo_module modules/mod_foo.so
  135. #
  136. LoadModule auth_basic_module modules/mod_auth_basic.so
  137. LoadModule auth_digest_module modules/mod_auth_digest.so
  138. LoadModule authn_file_module modules/mod_authn_file.so
  139. LoadModule authn_alias_module modules/mod_authn_alias.so
  140. LoadModule authn_anon_module modules/mod_authn_anon.so
  141. LoadModule authn_dbm_module modules/mod_authn_dbm.so
  142. LoadModule authn_default_module modules/mod_authn_default.so
  143. LoadModule authz_host_module modules/mod_authz_host.so
  144. LoadModule authz_user_module modules/mod_authz_user.so
  145. LoadModule authz_owner_module modules/mod_authz_owner.so
  146. LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
  147. LoadModule authz_dbm_module modules/mod_authz_dbm.so
  148. LoadModule authz_default_module modules/mod_authz_default.so
  149. LoadModule ldap_module modules/mod_ldap.so
  150. LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
  151. LoadModule include_module modules/mod_include.so
  152. LoadModule log_config_module modules/mod_log_config.so
  153. LoadModule logio_module modules/mod_logio.so
  154. LoadModule env_module modules/mod_env.so
  155. LoadModule ext_filter_module modules/mod_ext_filter.so
  156. LoadModule mime_magic_module modules/mod_mime_magic.so
  157. LoadModule expires_module modules/mod_expires.so
  158. LoadModule deflate_module modules/mod_deflate.so
  159. LoadModule headers_module modules/mod_headers.so
  160. LoadModule usertrack_module modules/mod_usertrack.so
  161. LoadModule setenvif_module modules/mod_setenvif.so
  162. LoadModule mime_module modules/mod_mime.so
  163. LoadModule dav_module modules/mod_dav.so
  164. LoadModule status_module modules/mod_status.so
  165. LoadModule autoindex_module modules/mod_autoindex.so
  166. LoadModule info_module modules/mod_info.so
  167. LoadModule dav_fs_module modules/mod_dav_fs.so
  168. LoadModule vhost_alias_module modules/mod_vhost_alias.so
  169. LoadModule negotiation_module modules/mod_negotiation.so
  170. LoadModule dir_module modules/mod_dir.so
  171. LoadModule actions_module modules/mod_actions.so
  172. LoadModule speling_module modules/mod_speling.so
  173. LoadModule userdir_module modules/mod_userdir.so
  174. LoadModule alias_module modules/mod_alias.so
  175. LoadModule rewrite_module modules/mod_rewrite.so
  176. LoadModule proxy_module modules/mod_proxy.so
  177. LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
  178. LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
  179. LoadModule proxy_http_module modules/mod_proxy_http.so
  180. LoadModule proxy_connect_module modules/mod_proxy_connect.so
  181. LoadModule cache_module modules/mod_cache.so
  182. LoadModule suexec_module modules/mod_suexec.so
  183. LoadModule disk_cache_module modules/mod_disk_cache.so
  184. LoadModule file_cache_module modules/mod_file_cache.so
  185. LoadModule mem_cache_module modules/mod_mem_cache.so
  186. LoadModule cgi_module modules/mod_cgi.so
  187. LoadModule version_module modules/mod_version.so
  188. #
  189. # The following modules are not loaded by default:
  190. #
  191. #LoadModule cern_meta_module modules/mod_cern_meta.so
  192. #LoadModule asis_module modules/mod_asis.so
  193. #
  194. # Load config files from the config directory "/etc/httpd/conf.d".
  195. #
  196. Include conf.d/*.conf
  197. #
  198. # ExtendedStatus controls whether Apache will generate "full" status
  199. # information (ExtendedStatus On) or just basic information (ExtendedStatus
  200. # Off) when the "server-status" handler is called. The default is Off.
  201. #
  202. #ExtendedStatus On
  203. #
  204. # If you wish httpd to run as a different user or group, you must run
  205. # httpd as root initially and it will switch.  
  206. #
  207. # User/Group: The name (or #number) of the user/group to run httpd as.
  208. #  . On SCO (ODT 3) use "User nouser" and "Group nogroup".
  209. #  . On HPUX you may not be able to use shared memory as nobody, and the
  210. #    suggested workaround is to create a user www and use that user.
  211. #  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
  212. #  when the value of (unsigned)Group is above 60000;
  213. #  don't use Group #-1 on these systems!
  214. #
  215. User apache
  216. Group apache
  217. ### Section 2: 'Main' server configuration
  218. #
  219. # The directives in this section set up the values used by the 'main'
  220. # server, which responds to any requests that aren't handled by a
  221. # <VirtualHost> definition.  These values also provide defaults for
  222. # any <VirtualHost> containers you may define later in the file.
  223. #
  224. # All of these directives may appear inside <VirtualHost> containers,
  225. # in which case these default settings will be overridden for the
  226. # virtual host being defined.
  227. #
  228. #
  229. # ServerAdmin: Your address, where problems with the server should be
  230. # e-mailed.  This address appears on some server-generated pages, such
  231. # as error documents.  e.g. admin@your-domain.com
  232. #
  233. ServerAdmin root@localhost
  234. #
  235. # ServerName gives the name and port that the server uses to identify itself.
  236. # This can often be determined automatically, but we recommend you specify
  237. # it explicitly to prevent problems during startup.
  238. #
  239. # If this is not set to valid DNS name for your host, server-generated
  240. # redirections will not work.  See also the UseCanonicalName directive.
  241. #
  242. # If your host doesn't have a registered DNS name, enter its IP address here.
  243. # You will have to access it by its address anyway, and this will make
  244. # redirections work in a sensible way.
  245. #
  246. #ServerName www.example.com:80
  247. #
  248. # UseCanonicalName: Determines how Apache constructs self-referencing
  249. # URLs and the SERVER_NAME and SERVER_PORT variables.
  250. # When set "Off", Apache will use the Hostname and Port supplied
  251. # by the client.  When set "On", Apache will use the value of the
  252. # ServerName directive.
  253. #
  254. UseCanonicalName Off
  255. #
  256. # DocumentRoot: The directory out of which you will serve your
  257. # documents. By default, all requests are taken from this directory, but
  258. # symbolic links and aliases may be used to point to other locations.
  259. #
  260. DocumentRoot "/var/www/html"
  261. #
  262. # Each directory to which Apache has access can be configured with respect
  263. # to which services and features are allowed and/or disabled in that
  264. # directory (and its subdirectories).
  265. #
  266. # First, we configure the "default" to be a very restrictive set of
  267. # features.  
  268. #
  269. <Directory />
  270.     Options FollowSymLinks
  271.     AllowOverride None
  272. </Directory>
  273. #
  274. # Note that from this point forward you must specifically allow
  275. # particular features to be enabled - so if something's not working as
  276. # you might expect, make sure that you have specifically enabled it
  277. # below.
  278. #
  279. #
  280. # This should be changed to whatever you set DocumentRoot to.
  281. #
  282. <Directory "/var/www/html">
  283. #
  284. # Possible values for the Options directive are "None", "All",
  285. # or any combination of:
  286. #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  287. #
  288. # Note that "MultiViews" must be named *explicitly* --- "Options All"
  289. # doesn't give it to you.
  290. #
  291. # The Options directive is both complicated and important.  Please see
  292. # http://httpd.apache.org/docs/2.2/mod/core.html#options
  293. # for more information.
  294. #
  295.     Options Indexes FollowSymLinks
  296. #
  297. # AllowOverride controls what directives may be placed in .htaccess files.
  298. # It can be "All", "None", or any combination of the keywords:
  299. #   Options FileInfo AuthConfig Limit
  300. #
  301.     AllowOverride None
  302. #
  303. # Controls who can get stuff from this server.
  304. #
  305.     Order allow,deny
  306.     Allow from all
  307. </Directory>
  308. #
  309. # UserDir: The name of the directory that is appended onto a user's home
  310. # directory if a ~user request is received.
  311. #
  312. # The path to the end user account 'public_html' directory must be
  313. # accessible to the webserver userid.  This usually means that ~userid
  314. # must have permissions of 711, ~userid/public_html must have permissions
  315. # of 755, and documents contained therein must be world-readable.
  316. # Otherwise, the client will only receive a "403 Forbidden" message.
  317. #
  318. # See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
  319. #
  320. <IfModule mod_userdir.c>
  321.     #
  322.     # UserDir is disabled by default since it can confirm the presence
  323.     # of a username on the system (depending on home directory
  324.     # permissions).
  325.     #
  326.     UserDir disable
  327.     #
  328.     # To enable requests to /~user/ to serve the user's public_html
  329.     # directory, remove the "UserDir disable" line above, and uncomment
  330.     # the following line instead:
  331.     #
  332.     #UserDir public_html
  333. </IfModule>
  334. #
  335. # Control access to UserDir directories.  The following is an example
  336. # for a site where these directories are restricted to read-only.
  337. #
  338. #<Directory /home/*/public_html>
  339. #    AllowOverride FileInfo AuthConfig Limit
  340. #    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  341. #    <Limit GET POST OPTIONS>
  342. #        Order allow,deny
  343. #        Allow from all
  344. #    </Limit>
  345. #    <LimitExcept GET POST OPTIONS>
  346. #        Order deny,allow
  347. #        Deny from all
  348. #    </LimitExcept>
  349. #</Directory>
  350. #
  351. # DirectoryIndex: sets the file that Apache will serve if a directory
  352. # is requested.
  353. #
  354. # The index.html.var file (a type-map) is used to deliver content-
  355. # negotiated documents.  The MultiViews Option can be used for the
  356. # same purpose, but it is much slower.
  357. #
  358. DirectoryIndex index.html index.html.var
  359. #
  360. # AccessFileName: The name of the file to look for in each directory
  361. # for additional configuration directives.  See also the AllowOverride
  362. # directive.
  363. #
  364. AccessFileName .htaccess
  365. #
  366. # The following lines prevent .htaccess and .htpasswd files from being
  367. # viewed by Web clients.
  368. #
  369. <Files ~ "^\.ht">
  370.     Order allow,deny
  371.     Deny from all
  372. </Files>
  373. #
  374. # TypesConfig describes where the mime.types file (or equivalent) is
  375. # to be found.
  376. #
  377. TypesConfig /etc/mime.types
  378. #
  379. # DefaultType is the default MIME type the server will use for a document
  380. # if it cannot otherwise determine one, such as from filename extensions.
  381. # If your server contains mostly text or HTML documents, "text/plain" is
  382. # a good value.  If most of your content is binary, such as applications
  383. # or images, you may want to use "application/octet-stream" instead to
  384. # keep browsers from trying to display binary files as though they are
  385. # text.
  386. #
  387. DefaultType text/plain
  388. #
  389. # The mod_mime_magic module allows the server to use various hints from the
  390. # contents of the file itself to determine its type.  The MIMEMagicFile
  391. # directive tells the module where the hint definitions are located.
  392. #
  393. <IfModule mod_mime_magic.c>
  394. #   MIMEMagicFile /usr/share/magic.mime
  395.     MIMEMagicFile conf/magic
  396. </IfModule>
  397. #
  398. # HostnameLookups: Log the names of clients or just their IP addresses
  399. # e.g., www.apache.org (on) or 204.62.129.132 (off).
  400. # The default is off because it'd be overall better for the net if people
  401. # had to knowingly turn this feature on, since enabling it means that
  402. # each client request will result in AT LEAST one lookup request to the
  403. # nameserver.
  404. #
  405. HostnameLookups Off
  406. #
  407. # EnableMMAP: Control whether memory-mapping is used to deliver
  408. # files (assuming that the underlying OS supports it).
  409. # The default is on; turn this off if you serve from NFS-mounted
  410. # filesystems.  On some systems, turning it off (regardless of
  411. # filesystem) can improve performance; for details, please see
  412. # http://httpd.apache.org/docs/2.2/mod/core.html#enablemmap
  413. #EnableMMAP off
  414. #
  415. # EnableSendfile: Control whether the sendfile kernel support is
  416. # used to deliver files (assuming that the OS supports it).
  417. # The default is on; turn this off if you serve from NFS-mounted
  418. # filesystems.  Please see
  419. # http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
  420. #
  421. #EnableSendfile off
  422. #
  423. # ErrorLog: The location of the error log file.
  424. # If you do not specify an ErrorLog directive within a <VirtualHost>
  425. # container, error messages relating to that virtual host will be
  426. # logged here.  If you *do* define an error logfile for a <VirtualHost>
  427. # container, that host's errors will be logged there and not here.
  428. #
  429. ErrorLog logs/error_log
  430. #
  431. # LogLevel: Control the number of messages logged to the error_log.
  432. # Possible values include: debug, info, notice, warn, error, crit,
  433. # alert, emerg.
  434. #
  435. LogLevel warn
  436. #
  437. # The following directives define some format nicknames for use with
  438. # a CustomLog directive (see below).
  439. #
  440. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  441. LogFormat "%h %l %u %t \"%r\" %>s %b" common
  442. LogFormat "%{Referer}i -> %U" referer
  443. LogFormat "%{User-agent}i" agent
  444. # "combinedio" includes actual counts of actual bytes received (%I) and sent (%O); this
  445. # requires the mod_logio module to be loaded.
  446. #LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
  447. #
  448. # The location and format of the access logfile (Common Logfile Format).
  449. # If you do not define any access logfiles within a <VirtualHost>
  450. # container, they will be logged here.  Contrariwise, if you *do*
  451. # define per-<VirtualHost> access logfiles, transactions will be
  452. # logged therein and *not* in this file.
  453. #
  454. #CustomLog logs/access_log common
  455. #
  456. # If you would like to have separate agent and referer logfiles, uncomment
  457. # the following directives.
  458. #
  459. #CustomLog logs/referer_log referer
  460. #CustomLog logs/agent_log agent
  461. #
  462. # For a single logfile with access, agent, and referer information
  463. # (Combined Logfile Format), use the following directive:
  464. #
  465. CustomLog logs/access_log combined
  466. #
  467. # Optionally add a line containing the server version and virtual host
  468. # name to server-generated pages (internal error documents, FTP directory
  469. # listings, mod_status and mod_info output etc., but not CGI generated
  470. # documents or custom error documents).
  471. # Set to "EMail" to also include a mailto: link to the ServerAdmin.
  472. # Set to one of:  On | Off | EMail
  473. #
  474. ServerSignature On
  475. #
  476. # Aliases: Add here as many aliases as you need (with no limit). The format is
  477. # Alias fakename realname
  478. #
  479. # Note that if you include a trailing / on fakename then the server will
  480. # require it to be present in the URL.  So "/icons" isn't aliased in this
  481. # example, only "/icons/".  If the fakename is slash-terminated, then the
  482. # realname must also be slash terminated, and if the fakename omits the
  483. # trailing slash, the realname must also omit it.
  484. #
  485. # We include the /icons/ alias for FancyIndexed directory listings.  If you
  486. # do not use FancyIndexing, you may comment this out.
  487. #
  488. Alias /icons/ "/var/www/icons/"
  489. <Directory "/var/www/icons">
  490.     Options Indexes MultiViews
  491.     AllowOverride None
  492.     Order allow,deny
  493.     Allow from all
  494. </Directory>
  495. #
  496. # WebDAV module configuration section.
  497. #
  498. <IfModule mod_dav_fs.c>
  499.     # Location of the WebDAV lock database.
  500.     DAVLockDB /var/lib/dav/lockdb
  501. </IfModule>
  502. #
  503. # ScriptAlias: This controls which directories contain server scripts.
  504. # ScriptAliases are essentially the same as Aliases, except that
  505. # documents in the realname directory are treated as applications and
  506. # run by the server when requested rather than as documents sent to the client.
  507. # The same rules about trailing "/" apply to ScriptAlias directives as to
  508. # Alias.
  509. #
  510. ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
  511. #
  512. # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
  513. # CGI directory exists, if you have that configured.
  514. #
  515. <Directory "/var/www/cgi-bin">
  516.     AllowOverride None
  517.     Options None
  518.     Order allow,deny
  519.     Allow from all
  520. </Directory>
  521. #
  522. # Redirect allows you to tell clients about documents which used to exist in
  523. # your server's namespace, but do not anymore. This allows you to tell the
  524. # clients where to look for the relocated document.
  525. # Example:
  526. # Redirect permanent /foo http://www.example.com/bar
  527. #
  528. # Directives controlling the display of server-generated directory listings.
  529. #
  530. #
  531. # IndexOptions: Controls the appearance of server-generated directory
  532. # listings.
  533. #
  534. IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable
  535. #
  536. # AddIcon* directives tell the server which icon to show for different
  537. # files or filename extensions.  These are only displayed for
  538. # FancyIndexed directories.
  539. #
  540. AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
  541. AddIconByType (TXT,/icons/text.gif) text/*
  542. AddIconByType (IMG,/icons/image2.gif) image/*
  543. AddIconByType (SND,/icons/sound2.gif) audio/*
  544. AddIconByType (VID,/icons/movie.gif) video/*
  545. AddIcon /icons/binary.gif .bin .exe
  546. AddIcon /icons/binhex.gif .hqx
  547. AddIcon /icons/tar.gif .tar
  548. AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
  549. AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
  550. AddIcon /icons/a.gif .ps .ai .eps
  551. AddIcon /icons/layout.gif .html .shtml .htm .pdf
  552. AddIcon /icons/text.gif .txt
  553. AddIcon /icons/c.gif .c
  554. AddIcon /icons/p.gif .pl .py
  555. AddIcon /icons/f.gif .for
  556. AddIcon /icons/dvi.gif .dvi
  557. AddIcon /icons/uuencoded.gif .uu
  558. AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
  559. AddIcon /icons/tex.gif .tex
  560. AddIcon /icons/bomb.gif core
  561. AddIcon /icons/back.gif ..
  562. AddIcon /icons/hand.right.gif README
  563. AddIcon /icons/folder.gif ^^DIRECTORY^^
  564. AddIcon /icons/blank.gif ^^BLANKICON^^
  565. #
  566. # DefaultIcon is which icon to show for files which do not have an icon
  567. # explicitly set.
  568. #
  569. DefaultIcon /icons/unknown.gif
  570. #
  571. # AddDescription allows you to place a short description after a file in
  572. # server-generated indexes.  These are only displayed for FancyIndexed
  573. # directories.
  574. # Format: AddDescription "description" filename
  575. #
  576. #AddDescription "GZIP compressed document" .gz
  577. #AddDescription "tar archive" .tar
  578. #AddDescription "GZIP compressed tar archive" .tgz
  579. #
  580. # ReadmeName is the name of the README file the server will look for by
  581. # default, and append to directory listings.
  582. #
  583. # HeaderName is the name of a file which should be prepended to
  584. # directory indexes.
  585. ReadmeName README.html
  586. HeaderName HEADER.html
  587. #
  588. # IndexIgnore is a set of filenames which directory indexing should ignore
  589. # and not include in the listing.  Shell-style wildcarding is permitted.
  590. #
  591. IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
  592. #
  593. # DefaultLanguage and AddLanguage allows you to specify the language of
  594. # a document. You can then use content negotiation to give a browser a
  595. # file in a language the user can understand.
  596. #
  597. # Specify a default language. This means that all data
  598. # going out without a specific language tag (see below) will
  599. # be marked with this one. You probably do NOT want to set
  600. # this unless you are sure it is correct for all cases.
  601. #
  602. # * It is generally better to not mark a page as
  603. # * being a certain language than marking it with the wrong
  604. # * language!
  605. #
  606. # DefaultLanguage nl
  607. #
  608. # Note 1: The suffix does not have to be the same as the language
  609. # keyword --- those with documents in Polish (whose net-standard
  610. # language code is pl) may wish to use "AddLanguage pl .po" to
  611. # avoid the ambiguity with the common suffix for perl scripts.
  612. #
  613. # Note 2: The example entries below illustrate that in some cases
  614. # the two character 'Language' abbreviation is not identical to
  615. # the two character 'Country' code for its country,
  616. # E.g. 'Danmark/dk' versus 'Danish/da'.
  617. #
  618. # Note 3: In the case of 'ltz' we violate the RFC by using a three char
  619. # specifier. There is 'work in progress' to fix this and get
  620. # the reference data for rfc1766 cleaned up.
  621. #
  622. # Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)
  623. # English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)
  624. # Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)
  625. # Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)
  626. # Norwegian (no) - Polish (pl) - Portugese (pt)
  627. # Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)
  628. # Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)
  629. #
  630. AddLanguage ca .ca
  631. AddLanguage cs .cz .cs
  632. AddLanguage da .dk
  633. AddLanguage de .de
  634. AddLanguage el .el
  635. AddLanguage en .en
  636. AddLanguage eo .eo
  637. AddLanguage es .es
  638. AddLanguage et .et
  639. AddLanguage fr .fr
  640. AddLanguage he .he
  641. AddLanguage hr .hr
  642. AddLanguage it .it
  643. AddLanguage ja .ja
  644. AddLanguage ko .ko
  645. AddLanguage ltz .ltz
  646. AddLanguage nl .nl
  647. AddLanguage nn .nn
  648. AddLanguage no .no
  649. AddLanguage pl .po
  650. AddLanguage pt .pt
  651. AddLanguage pt-BR .pt-br
  652. AddLanguage ru .ru
  653. AddLanguage sv .sv
  654. AddLanguage zh-CN .zh-cn
  655. AddLanguage zh-TW .zh-tw
  656. #
  657. # LanguagePriority allows you to give precedence to some languages
  658. # in case of a tie during content negotiation.
  659. #
  660. # Just list the languages in decreasing order of preference. We have
  661. # more or less alphabetized them here. You probably want to change this.
  662. #
  663. LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
  664. #
  665. # ForceLanguagePriority allows you to serve a result page rather than
  666. # MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
  667. # [in case no accepted languages matched the available variants]
  668. #
  669. ForceLanguagePriority Prefer Fallback
  670. #
  671. # Specify a default charset for all content served; this enables
  672. # interpretation of all content as UTF-8 by default.  To use the
  673. # default browser choice (ISO-8859-1), or to allow the META tags
  674. # in HTML content to override this choice, comment out this
  675. # directive:
  676. #
  677. AddDefaultCharset UTF-8
  678. # AddType allows you to add to or override the MIME configuration
  679. # file mime.types for specific file types.
  680. #
  681. #AddType application/x-tar .tgz
  682. #
  683. # AddEncoding allows you to have certain browsers uncompress
  684. # information on the fly. Note: Not all browsers support this.
  685. # Despite the name similarity, the following Add* directives have nothing
  686. # to do with the FancyIndexing customization directives above.
  687. #
  688. #AddEncoding x-compress .Z
  689. #AddEncoding x-gzip .gz .tgz
  690. # If the AddEncoding directives above are commented-out, then you
  691. # probably should define those extensions to indicate media types:
  692. #
  693. AddType application/x-compress .Z
  694. AddType application/x-gzip .gz .tgz
  695. #
  696. # AddHandler allows you to map certain file extensions to "handlers":
  697. # actions unrelated to filetype. These can be either built into the server
  698. # or added with the Action directive (see below)
  699. #
  700. # To use CGI scripts outside of ScriptAliased directories:
  701. # (You will also need to add "ExecCGI" to the "Options" directive.)
  702. #
  703. #AddHandler cgi-script .cgi
  704. #
  705. # For files that include their own HTTP headers:
  706. #
  707. #AddHandler send-as-is asis
  708. #
  709. # For type maps (negotiated resources):
  710. # (This is enabled by default to allow the Apache "It Worked" page
  711. #  to be distributed in multiple languages.)
  712. #
  713. AddHandler type-map var
  714. #
  715. # Filters allow you to process content before it is sent to the client.
  716. #
  717. # To parse .shtml files for server-side includes (SSI):
  718. # (You will also need to add "Includes" to the "Options" directive.)
  719. #
  720. AddType text/html .shtml
  721. AddOutputFilter INCLUDES .shtml
  722. #
  723. # Action lets you define media types that will execute a script whenever
  724. # a matching file is called. This eliminates the need for repeated URL
  725. # pathnames for oft-used CGI file processors.
  726. # Format: Action media/type /cgi-script/location
  727. # Format: Action handler-name /cgi-script/location
  728. #
  729. #
  730. # Customizable error responses come in three flavors:
  731. # 1) plain text 2) local redirects 3) external redirects
  732. #
  733. # Some examples:
  734. #ErrorDocument 500 "The server made a boo boo."
  735. #ErrorDocument 404 /missing.html
  736. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  737. #ErrorDocument 402 http://www.example.com/subscription_info.html
  738. #
  739. #
  740. # Putting this all together, we can internationalize error responses.
  741. #
  742. # We use Alias to redirect any /error/HTTP_<error>.html.var response to
  743. # our collection of by-error message multi-language collections.  We use
  744. # includes to substitute the appropriate text.
  745. #
  746. # You can modify the messages' appearance without changing any of the
  747. # default HTTP_<error>.html.var files by adding the line:
  748. #
  749. #   Alias /error/include/ "/your/include/path/"
  750. #
  751. # which allows you to create your own set of files by starting with the
  752. # /var/www/error/include/ files and
  753. # copying them to /your/include/path/, even on a per-VirtualHost basis.
  754. #
  755. Alias /error/ "/var/www/error/"
  756. <IfModule mod_negotiation.c>
  757. <IfModule mod_include.c>
  758.     <Directory "/var/www/error">
  759.         AllowOverride None
  760.         Options IncludesNoExec
  761.         AddOutputFilter Includes html
  762.         AddHandler type-map var
  763.         Order allow,deny
  764.         Allow from all
  765.         LanguagePriority en es de fr
  766.         ForceLanguagePriority Prefer Fallback
  767.     </Directory>
  768. #    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
  769. #    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
  770. #    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
  771. #    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
  772. #    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
  773. #    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
  774. #    ErrorDocument 410 /error/HTTP_GONE.html.var
  775. #    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
  776. #    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
  777. #    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
  778. #    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
  779. #    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
  780. #    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
  781. #    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
  782. #    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
  783. #    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
  784. #    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
  785. </IfModule>
  786. </IfModule>
  787. #
  788. # The following directives modify normal HTTP response behavior to
  789. # handle known problems with browser implementations.
  790. #
  791. BrowserMatch "Mozilla/2" nokeepalive
  792. BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
  793. BrowserMatch "RealPlayer 4\.0" force-response-1.0
  794. BrowserMatch "Java/1\.0" force-response-1.0
  795. BrowserMatch "JDK/1\.0" force-response-1.0
  796. #
  797. # The following directive disables redirects on non-GET requests for
  798. # a directory that does not include the trailing slash.  This fixes a
  799. # problem with Microsoft WebFolders which does not appropriately handle
  800. # redirects for folders with DAV methods.
  801. # Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
  802. #
  803. BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
  804. BrowserMatch "MS FrontPage" redirect-carefully
  805. BrowserMatch "^WebDrive" redirect-carefully
  806. BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
  807. BrowserMatch "^gnome-vfs/1.0" redirect-carefully
  808. BrowserMatch "^XML Spy" redirect-carefully
  809. BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
  810. #
  811. # Allow server status reports generated by mod_status,
  812. # with the URL of http://servername/server-status
  813. # Change the ".example.com" to match your domain to enable.
  814. #
  815. #<Location /server-status>
  816. #    SetHandler server-status
  817. #    Order deny,allow
  818. #    Deny from all
  819. #    Allow from .example.com
  820. #</Location>
  821. #
  822. # Allow remote server configuration reports, with the URL of
  823. #  http://servername/server-info (requires that mod_info.c be loaded).
  824. # Change the ".example.com" to match your domain to enable.
  825. #
  826. #<Location /server-info>
  827. #    SetHandler server-info
  828. #    Order deny,allow
  829. #    Deny from all
  830. #    Allow from .example.com
  831. #</Location>
  832. #
  833. # Proxy Server directives. Uncomment the following lines to
  834. # enable the proxy server:
  835. #
  836. #<IfModule mod_proxy.c>
  837. #ProxyRequests On
  838. #
  839. #<Proxy *>
  840. #    Order deny,allow
  841. #    Deny from all
  842. #    Allow from .example.com
  843. #</Proxy>
  844. #
  845. # Enable/disable the handling of HTTP/1.1 "Via:" headers.
  846. # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
  847. # Set to one of: Off | On | Full | Block
  848. #
  849. #ProxyVia On
  850. #
  851. # To enable a cache of proxied content, uncomment the following lines.
  852. # See http://httpd.apache.org/docs/2.2/mod/mod_cache.html for more details.
  853. #
  854. #<IfModule mod_disk_cache.c>
  855. #   CacheEnable disk /
  856. #   CacheRoot "/var/cache/mod_proxy"
  857. #</IfModule>
  858. #
  859. #</IfModule>
  860. # End of proxy directives.
  861. ### Section 3: Virtual Hosts
  862. #
  863. # VirtualHost: If you want to maintain multiple domains/hostnames on your
  864. # machine you can setup VirtualHost containers for them. Most configurations
  865. # use only name-based virtual hosts so the server doesn't need to worry about
  866. # IP addresses. This is indicated by the asterisks in the directives below.
  867. #
  868. # Please see the documentation at
  869. # <URL:http://httpd.apache.org/docs/2.2/vhosts/>;
  870. # for further details before you try to setup virtual hosts.
  871. #
  872. # You may use the command line option '-S' to verify your virtual host
  873. # configuration.
  874. #
  875. # Use name-based virtual hosting.
  876. #
  877. #NameVirtualHost *:80
  878. #
  879. # NOTE: NameVirtualHost cannot be used without a port specifier
  880. # (e.g. :80) if mod_ssl is being used, due to the nature of the
  881. # SSL protocol.
  882. #
  883. #
  884. # VirtualHost example:
  885. # Almost any Apache directive may go into a VirtualHost container.
  886. # The first VirtualHost section is used for requests without a known
  887. # server name.
  888. #
  889. #<VirtualHost *:80>
  890. #    ServerAdmin webmaster@dummy-host.example.com
  891. #    DocumentRoot /www/docs/dummy-host.example.com
  892. #    ServerName dummy-host.example.com
  893. #    ErrorLog logs/dummy-host.example.com-error_log
  894. #    CustomLog logs/dummy-host.example.com-access_log common
  895. #</VirtualHost>
  896. #配置虚拟主机
  897. NameVirtualHost 192.168.0.254:80
  898. <VirtualHost 192.168.0.254:80>
  899.     ServerAdmin webmaster@test.org
  900.     DocumentRoot /var/www/html/test.org/
  901.     ServerName www.test.org
  902.     ErrorLog logs/www.test.org-error_log
  903.     CustomLog logs/www.test.org-access_log common
  904. </VirtualHost>
  905. <VirtualHost 192.168.0.254:80>
  906.     ServerAdmin webmaster@test.org
  907.     DocumentRoot /var/www/html/test.org/t/
  908.     ServerName ftp.test.org
  909.     ErrorLog logs/ftp.test.org-error_log
  910.     CustomLog logs/ftp.test.org-access_log common
  911. </VirtualHost>
复制代码

TOP

Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20

帖子
1135 
精华
144 
积分
8341 
UID
2
发表于 2011-4-15 13:53 | 只看该作者
2楼:保留位置,以便以后继续更新中

TOP

Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20

帖子
1135 
精华
144 
积分
8341 
UID
3
发表于 2011-4-15 13:53 | 只看该作者
3楼 继续占位置

TOP

Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20

帖子
1135 
精华
144 
积分
8341 
UID
4
发表于 2011-4-15 13:54 | 只看该作者
4楼 相关参考资料

TOP

IT你好技术论坛

GMT+8, 2026-1-13 07:36, Processed in 0.023976 second(s), 15 queries.

Powered by Discuz! X1

© 2001-2010 Comsenz Inc.