apache2.conf 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. # This is the main Apache server configuration file. It contains the
  2. # configuration directives that give the server its instructions.
  3. # See http://httpd.apache.org/docs/2.2/ for detailed information about
  4. # the directives and /usr/share/doc/apache2-common/README.Debian.gz about
  5. # Debian specific hints.
  6. #
  7. #
  8. # Summary of how the Apache 2 configuration works in Debian:
  9. # The Apache 2 web server configuration in Debian is quite different to
  10. # upstream's suggested way to configure the web server. This is because Debian's
  11. # default Apache2 installation attempts to make adding and removing modules,
  12. # virtual hosts, and extra configuration directives as flexible as possible, in
  13. # order to make automating the changes and administering the server as easy as
  14. # possible.
  15. # It is split into several files forming the configuration hierarchy outlined
  16. # below, all located in the /etc/apache2/ directory:
  17. #
  18. # /etc/apache2/
  19. # |-- apache2.conf
  20. # | `-- ports.conf
  21. # |-- mods-enabled
  22. # | |-- *.load
  23. # | `-- *.conf
  24. # |-- conf.d
  25. # | `-- *
  26. # `-- sites-enabled
  27. # `-- *
  28. #
  29. #
  30. # * apache2.conf is the main configuration file (this file). It puts the pieces
  31. # together by including all remaining configuration files when starting up the
  32. # web server.
  33. #
  34. # In order to avoid conflicts with backup files, the Include directive is
  35. # adapted to ignore files that:
  36. # - do not begin with a letter or number
  37. # - contain a character that is neither letter nor number nor _-:.
  38. # - contain .dpkg
  39. #
  40. # Yet we strongly suggest that all configuration files either end with a
  41. # .conf or .load suffix in the file name. The next Debian release will
  42. # ignore files not ending with .conf (or .load for mods-enabled).
  43. #
  44. # * ports.conf is always included from the main configuration file. It is
  45. # supposed to determine listening ports for incoming connections, and which
  46. # of these ports are used for name based virtual hosts.
  47. #
  48. # * Configuration files in the mods-enabled/ and sites-enabled/ directories
  49. # contain particular configuration snippets which manage modules or virtual
  50. # host configurations, respectively.
  51. #
  52. # They are activated by symlinking available configuration files from their
  53. # respective *-available/ counterparts. These should be managed by using our
  54. # helpers a2enmod/a2dismod, a2ensite/a2dissite. See
  55. # their respective man pages for detailed information.
  56. #
  57. # * Configuration files in the conf.d directory are either provided by other
  58. # packages or may be added by the local administrator. Local additions
  59. # should start with local- or end with .local.conf to avoid name clashes. All
  60. # files in conf.d are considered (excluding the exceptions noted above) by
  61. # the Apache 2 web server.
  62. #
  63. # * The binary is called apache2. Due to the use of environment variables, in
  64. # the default configuration, apache2 needs to be started/stopped with
  65. # /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
  66. # work with the default configuration.
  67. # Global configuration
  68. #
  69. #
  70. # ServerRoot: The top of the directory tree under which the server's
  71. # configuration, error, and log files are kept.
  72. #
  73. # NOTE! If you intend to place this on an NFS (or otherwise network)
  74. # mounted filesystem then please read the LockFile documentation (available
  75. # at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
  76. # you will save yourself a lot of trouble.
  77. #
  78. # Do NOT add a slash at the end of the directory path.
  79. #
  80. #ServerRoot "/etc/apache2"
  81. #
  82. # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
  83. #
  84. LockFile ${APACHE_LOCK_DIR}/accept.lock
  85. #
  86. # PidFile: The file in which the server should record its process
  87. # identification number when it starts.
  88. # This needs to be set in /etc/apache2/envvars
  89. #
  90. PidFile ${APACHE_PID_FILE}
  91. #
  92. # Timeout: The number of seconds before receives and sends time out.
  93. #
  94. Timeout 300
  95. #
  96. # KeepAlive: Whether or not to allow persistent connections (more than
  97. # one request per connection). Set to "Off" to deactivate.
  98. #
  99. KeepAlive On
  100. #
  101. # MaxKeepAliveRequests: The maximum number of requests to allow
  102. # during a persistent connection. Set to 0 to allow an unlimited amount.
  103. # We recommend you leave this number high, for maximum performance.
  104. #
  105. MaxKeepAliveRequests 100
  106. #
  107. # KeepAliveTimeout: Number of seconds to wait for the next request from the
  108. # same client on the same connection.
  109. #
  110. KeepAliveTimeout 5
  111. ##
  112. ## Server-Pool Size Regulation (MPM specific)
  113. ##
  114. # prefork MPM
  115. # StartServers: number of server processes to start
  116. # MinSpareServers: minimum number of server processes which are kept spare
  117. # MaxSpareServers: maximum number of server processes which are kept spare
  118. # MaxClients: maximum number of server processes allowed to start
  119. # MaxRequestsPerChild: maximum number of requests a server process serves
  120. <IfModule mpm_prefork_module>
  121. StartServers 5
  122. MinSpareServers 5
  123. MaxSpareServers 10
  124. MaxClients 150
  125. MaxRequestsPerChild 0
  126. </IfModule>
  127. # worker MPM
  128. # StartServers: initial number of server processes to start
  129. # MinSpareThreads: minimum number of worker threads which are kept spare
  130. # MaxSpareThreads: maximum number of worker threads which are kept spare
  131. # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
  132. # graceful restart. ThreadLimit can only be changed by stopping
  133. # and starting Apache.
  134. # ThreadsPerChild: constant number of worker threads in each server process
  135. # MaxClients: maximum number of simultaneous client connections
  136. # MaxRequestsPerChild: maximum number of requests a server process serves
  137. <IfModule mpm_worker_module>
  138. StartServers 2
  139. MinSpareThreads 25
  140. MaxSpareThreads 75
  141. ThreadLimit 64
  142. ThreadsPerChild 25
  143. MaxClients 150
  144. MaxRequestsPerChild 0
  145. </IfModule>
  146. # event MPM
  147. # StartServers: initial number of server processes to start
  148. # MinSpareThreads: minimum number of worker threads which are kept spare
  149. # MaxSpareThreads: maximum number of worker threads which are kept spare
  150. # ThreadsPerChild: constant number of worker threads in each server process
  151. # MaxClients: maximum number of simultaneous client connections
  152. # MaxRequestsPerChild: maximum number of requests a server process serves
  153. <IfModule mpm_event_module>
  154. StartServers 1
  155. MinSpareThreads 2
  156. MaxSpareThreads 5
  157. ThreadLimit 20
  158. ThreadsPerChild 20
  159. MaxClients 60
  160. MaxRequestsPerChild 5000
  161. </IfModule>
  162. # These need to be set in /etc/apache2/envvars
  163. User ${APACHE_RUN_USER}
  164. Group ${APACHE_RUN_GROUP}
  165. #
  166. # AccessFileName: The name of the file to look for in each directory
  167. # for additional configuration directives. See also the AllowOverride
  168. # directive.
  169. #
  170. AccessFileName .htaccess
  171. #
  172. # The following lines prevent .htaccess and .htpasswd files from being
  173. # viewed by Web clients.
  174. #
  175. <Files ~ "^\.ht">
  176. Order allow,deny
  177. Deny from all
  178. Satisfy all
  179. </Files>
  180. # TuxLite. Better to put this block here compared to Debian's default
  181. <Directory />
  182. Options -Indexes FollowSymLinks
  183. AllowOverride All
  184. Order allow,deny
  185. allow from all
  186. </Directory>
  187. #
  188. # DefaultType is the default MIME type the server will use for a document
  189. # if it cannot otherwise determine one, such as from filename extensions.
  190. # If your server contains mostly text or HTML documents, "text/plain" is
  191. # a good value. If most of your content is binary, such as applications
  192. # or images, you may want to use "application/octet-stream" instead to
  193. # keep browsers from trying to display binary files as though they are
  194. # text.
  195. #
  196. # It is also possible to omit any default MIME type and let the
  197. # client's browser guess an appropriate action instead. Typically the
  198. # browser will decide based on the file's extension then. In cases
  199. # where no good assumption can be made, letting the default MIME type
  200. # unset is suggested instead of forcing the browser to accept
  201. # incorrect metadata.
  202. #
  203. DefaultType None
  204. #
  205. # HostnameLookups: Log the names of clients or just their IP addresses
  206. # e.g., www.apache.org (on) or 204.62.129.132 (off).
  207. # The default is off because it'd be overall better for the net if people
  208. # had to knowingly turn this feature on, since enabling it means that
  209. # each client request will result in AT LEAST one lookup request to the
  210. # nameserver.
  211. #
  212. HostnameLookups Off
  213. # ErrorLog: The location of the error log file.
  214. # If you do not specify an ErrorLog directive within a <VirtualHost>
  215. # container, error messages relating to that virtual host will be
  216. # logged here. If you *do* define an error logfile for a <VirtualHost>
  217. # container, that host's errors will be logged there and not here.
  218. #
  219. ErrorLog ${APACHE_LOG_DIR}/error.log
  220. #
  221. # LogLevel: Control the number of messages logged to the error_log.
  222. # Possible values include: debug, info, notice, warn, error, crit,
  223. # alert, emerg.
  224. #
  225. LogLevel warn
  226. # Include module configuration:
  227. Include mods-enabled/*.load
  228. Include mods-enabled/*.conf
  229. # Include list of ports to listen on and which to use for name based vhosts
  230. Include ports.conf
  231. #
  232. # The following directives define some format nicknames for use with
  233. # a CustomLog directive (see below).
  234. # If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
  235. #
  236. LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
  237. LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
  238. LogFormat "%h %l %u %t \"%r\" %>s %O" common
  239. LogFormat "%{Referer}i -> %U" referer
  240. LogFormat "%{User-agent}i" agent
  241. # Include of directories ignores editors' and dpkg's backup files,
  242. # see the comments above for details.
  243. # Include generic snippets of statements
  244. Include conf.d/
  245. # Include the virtual host configurations:
  246. Include sites-enabled/