PageRenderTime 57ms CodeModel.GetById 2ms RepoModel.GetById 0ms app.codeStats 1ms

/mod_perl/apache_1.3.23/htdocs/manual/misc/FAQ.html

https://github.com/gitpan/AxKit-Needs
HTML | 3653 lines | 2762 code | 841 blank | 50 comment | 0 complexity | e9e67ed4bfd804771e8b448fea6ce553 MD5 | raw file
Possible License(s): LGPL-2.0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta name="generator" content="HTML Tidy, see www.w3.org" />
  6. <title>Apache Server Frequently Asked Questions</title>
  7. </head>
  8. <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
  9. <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
  10. vlink="#000080" alink="#FF0000">
  11. <div align="CENTER">
  12. <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" />
  13. <h3>Apache HTTP Server Version 1.3</h3>
  14. </div>
  15. <h1 align="CENTER">Apache Server Frequently Asked
  16. Questions</h1>
  17. <p>$Revision: 1.149 $ ($Date: 2001/10/08 01:26:54 $)</p>
  18. <p>The latest version of this FAQ is always available from the
  19. main Apache web site, at &lt;<a
  20. href="http://httpd.apache.org/docs/misc/FAQ.html"
  21. rel="Help"><samp>http://httpd.apache.org/docs/misc/FAQ.html</samp></a>&gt;.</p>
  22. <!-- Notes about changes: -->
  23. <!-- - If adding a relative link to another part of the -->
  24. <!-- documentation, *do* include the ".html" portion. There's a -->
  25. <!-- good chance that the user will be reading the documentation -->
  26. <!-- on his own system, which may not be configured for -->
  27. <!-- multiviews. -->
  28. <!-- - When adding items, make sure they're put in the right place -->
  29. <!-- - verify that the numbering matches up. -->
  30. <!-- - *Don't* use <PRE></PRE> blocks - they don't appear -->
  31. <!-- correctly in a reliable way when this is converted to text -->
  32. <!-- with Lynx. Use <DL><DD><CODE>xxx<BR>xx</CODE></DD></DL> -->
  33. <!-- blocks inside a <P></P> instead. This is necessary to get -->
  34. <!-- the horizontal and vertical indenting right. -->
  35. <!-- - Don't forget to include an HR tag after the last /P tag -->
  36. <!-- but before the /LI in an item. -->
  37. <p>If you are reading a text-only version of this FAQ, you may
  38. find numbers enclosed in brackets (such as "[12]"). These refer
  39. to the list of reference URLs to be found at the end of the
  40. document. These references do not appear, and are not needed,
  41. for the hypertext version.</p>
  42. <h2>The Questions</h2>
  43. <!-- Stuff to Add: -->
  44. <!-- - can't bind to port 80 -->
  45. <!-- - permission denied -->
  46. <!-- - address already in use -->
  47. <!-- - mod_auth & passwd lines "user:pw:.*" - ++1st colon onward is -->
  48. <!-- treated as pw, not just ++1st to \-\-2nd. -->
  49. <!-- - SSL: -->
  50. <!-- - Can I use Apache-SSL for free in Canada? -->
  51. <!-- - Why can't I use Apache-SSL in the U.S.? -->
  52. <!-- - How can I found out how many visitors my site gets? -->
  53. <!-- - How do I add a counter? -->
  54. <!-- - How do I configure Apache as a proxy? -->
  55. <!-- - What browsers support HTTP/1.1? -->
  56. <!-- - What's the point of vhosts-by-name is there aren't any -->
  57. <!-- HTTP/1.1 browsers? -->
  58. <!-- - Is there an Apache for W95/WNT? -->
  59. <!-- - Why does Apache die when a vhost can't be DNS-resolved? -->
  60. <!-- - Why do I get "send lost connection" messages in my error -->
  61. <!-- log? -->
  62. <!-- - specifically consider .pdf files which seem to cause this -->
  63. <!-- a lot when accessed via the plugin ... and also mention -->
  64. <!-- how range-requests can cause bytes served < file size -->
  65. <!-- - Why do directory indexes appear as garbage? (A: -lucb) -->
  66. <!-- - How do I add a footer to all pages offered by my server? -->
  67. <!-- - Fix midi question; a bigger problem than midi vs. x-midi is -->
  68. <!-- the simple fact that older versions of Apache (and new ones -->
  69. <!-- that have been upgraded without upgrading the mime.types -->
  70. <!-- file) don't have the type listed at all. -->
  71. <!-- - RewriteRule /~fraggle/* /cgi-bin/fraggle.pl does not work -->
  72. <!-- - how do I disable authentication for a subdirectory? -->
  73. <!-- (A: you can't but "Satisfy any; Allow from all" can be close -->
  74. <!-- - '400 malformed request' on Win32 might mean stale proxy; see -->
  75. <!-- PR #2300. -->
  76. <!-- - how do I tell what version of Apache I am running? -->
  77. <ol type="A">
  78. <li value="1">
  79. <strong>Background</strong>
  80. <ol>
  81. <li><a href="#what">What is Apache?</a></li>
  82. <li><a href="#why">How and why was Apache
  83. created?</a></li>
  84. <li><a href="#name">Why the name "Apache"?</a></li>
  85. <li><a href="#compare">OK, so how does Apache compare to
  86. other servers?</a></li>
  87. <li><a href="#tested">How thoroughly tested is
  88. Apache?</a></li>
  89. <li><a href="#future">What are the future plans for
  90. Apache?</a></li>
  91. <li><a href="#support">Whom do I contact for
  92. support?</a></li>
  93. <li><a href="#more">Is there any more information on
  94. Apache?</a></li>
  95. <li><a href="#where">Where can I get Apache?</a></li>
  96. <li><a href="#logo">May I use the Apache logo on my
  97. product or Web site?</a></li>
  98. </ol>
  99. </li>
  100. </body>
  101. </html>
  102. <li value="2">
  103. <strong>General Technical Questions</strong>
  104. <ol>
  105. <li><a href="#what2do">"Why can't I ...? Why won't ...
  106. work?" What to do in case of problems</a></li>
  107. <li><a href="#compatible">How compatible is Apache with
  108. my existing NCSA 1.3 setup?</a></li>
  109. <li><a href="#year2000">Is Apache Year 2000
  110. compliant?</a></li>
  111. <li><a href="#submit_patch">How do I submit a patch to
  112. the Apache Group?</a></li>
  113. <li><a href="#domination">Why has Apache stolen my
  114. favourite site's Internet address?</a></li>
  115. <li><a href="#apspam">Why am I getting spam mail from the
  116. Apache site?</a></li>
  117. <li><a href="#redist">May I include the Apache software
  118. on a CD or other package I'm distributing?</a></li>
  119. <li><a href="#zoom">What's the best hardware/operating
  120. system/... How do I get the most out of my Apache Web
  121. server?</a></li>
  122. <li><a href="#regex">What are "regular
  123. expressions"?</a></li>
  124. <li><a href="#binaries">Why isn't there a binary for my
  125. platform?</a></li>
  126. </ol>
  127. </li>
  128. </body>
  129. </html>
  130. <li value="3">
  131. <strong>Building Apache</strong>
  132. <ol>
  133. <li><a href="#bind8.1">Why do I get an error about an
  134. undefined reference to "<samp>__inet_ntoa</samp>" or
  135. other <samp>__inet_*</samp> symbols?</a></li>
  136. <li><a href="#cantbuild">Why won't Apache compile with my
  137. system's <samp>cc</samp>?</a></li>
  138. <li><a href="#linuxiovec">Why do I get complaints about
  139. redefinition of "<code>struct iovec</code>" when
  140. compiling under Linux?</a></li>
  141. <li><a href="#broken-gcc">I'm using gcc and I get some
  142. compilation errors, what is wrong?</a></li>
  143. <li><a href="#glibc-crypt">I'm using RedHat Linux 5.0, or
  144. some other <samp>glibc</samp>-based Linux system, and I
  145. get errors with the <code>crypt</code> function when I
  146. attempt to build Apache 1.2.</a></li>
  147. </ol>
  148. </li>
  149. </body>
  150. </html>
  151. <li value="4">
  152. <strong>Error Log Messages and Problems Starting
  153. Apache</strong>
  154. <ol>
  155. <li><a href="#setgid">Why do I get "<samp>setgid: Invalid
  156. argument</samp>" at startup?</a></li>
  157. <li><a href="#nodelay">Why am I getting "<samp>httpd:
  158. could not set socket option TCP_NODELAY</samp>" in my
  159. error log?</a></li>
  160. <li><a href="#peerreset">Why am I getting
  161. "<samp>connection reset by peer</samp>" in my error
  162. log?</a></li>
  163. <li><a href="#wheres-the-dump">The errorlog says Apache
  164. dumped core, but where's the dump file?</a></li>
  165. <li><a href="#linux-shmget">When I run it under Linux I
  166. get "shmget: function not found", what should I
  167. do?</a></li>
  168. <li><a href="#nfslocking">Server hangs, or fails to
  169. start, and/or error log fills with "<samp>fcntl:
  170. F_SETLKW: No record locks available</samp>" or similar
  171. messages</a></li>
  172. <li><a href="#aixccbug">Why am I getting "<samp>Expected
  173. &lt;/Directory&gt; but saw &lt;/Directory&gt;</samp>"
  174. when I try to start Apache?</a></li>
  175. <li><a href="#redhat">I'm using RedHat Linux and I have
  176. problems with httpd dying randomly or not restarting
  177. properly</a></li>
  178. <li><a href="#stopping">I upgraded from an Apache version
  179. earlier than 1.2.0 and suddenly I have problems with
  180. Apache dying randomly or not restarting properly</a></li>
  181. <li><a href="#setservername">When I try to start Apache
  182. from a DOS window, I get a message like "<samp>Cannot
  183. determine host name. Use ServerName directive to set it
  184. manually.</samp>" What does this mean?</a></li>
  185. <li><a href="#ws2_32dll">When I try to start Apache for
  186. Windows, I get a message like "<samp>Unable To Locate
  187. WS2_32.DLL...</samp>". What should I do?</a></li>
  188. <li><a href="#WSADuplicateSocket">Apache for Windows does
  189. not start. Error log contains this message "<samp>[crit]
  190. (10045) The attempted operation is not supported for the
  191. type of object referenced: Parent: WSADuplicateSocket
  192. failed for socket ###</samp>". What does this
  193. mean?</a></li>
  194. <li><a href="#err1067">When I try to start Apache on
  195. Windows, I get a message like "<code>System error 1067
  196. has occurred. The process terminated
  197. unexpectedly.</code>" What does this mean?</a></li>
  198. <li><a href="#suseFDN">On a SuSE Linux system, I try and
  199. configure access control using basic authentication.
  200. Although I follow the example exactly, authentication
  201. fails, and an error message "<code>admin: not a valid
  202. FDN: ....</code>" is logged.</a></li>
  203. <li><a href="#codered">Why do I have weird entries in my
  204. logs asking for <code>default.ida</code> and
  205. <code>cmd.exe</code>?</a></li>
  206. </ol>
  207. </li>
  208. </body>
  209. </html>
  210. <li value="5">
  211. <strong>Configuration Questions</strong>
  212. <ol>
  213. <li><a href="#fdlim">Why can't I run more than
  214. &lt;<em>n</em>&gt; virtual hosts?</a></li>
  215. <li><a href="#freebsd-setsize">Can I increase
  216. <samp>FD_SETSIZE</samp> on FreeBSD?</a></li>
  217. <li><a href="#errordoc401">Why doesn't my
  218. <code>ErrorDocument 401</code> work?</a></li>
  219. <li><a href="#cookies1">Why does Apache send a cookie on
  220. every response?</a></li>
  221. <li><a href="#cookies2">Why don't my cookies work, I even
  222. compiled in <samp>mod_cookies</samp>?</a></li>
  223. <li><a href="#jdk1-and-http1.1">Why do my Java app[let]s
  224. give me plain text when I request an URL from an Apache
  225. server?</a></li>
  226. <li><a href="#midi">How do I get Apache to send a MIDI
  227. file so the browser can play it?</a></li>
  228. <li><a href="#addlog">How do I add browsers and referrers
  229. to my logs?</a></li>
  230. <li><a href="#set-servername">Why does accessing
  231. directories only work when I include the trailing "/"
  232. (<em>e.g.</em>,&nbsp;<samp>http://foo.domain.com/~user/</samp>)
  233. but not when I omit it
  234. (<em>e.g.</em>,&nbsp;<samp>http://foo.domain.com/~user</samp>)?</a></li>
  235. <li><a href="#no-info-directives">Why doesn't mod_info
  236. list any directives?</a></li>
  237. <li><a href="#namevhost">I upgraded to Apache 1.3 and now
  238. my virtual hosts don't work!</a></li>
  239. <li><a href="#redhat-htm">I'm using RedHat Linux and my
  240. .htm files are showing up as HTML source rather than
  241. being formatted!</a></li>
  242. <li><a href="#htaccess-work">My <code>.htaccess</code>
  243. files are being ignored.</a></li>
  244. <li><a href="#forbidden">Why do I get a
  245. "<samp>Forbidden</samp>" message whenever I try to access
  246. a particular directory?</a></li>
  247. <li><a href="#malfiles">Why do I get a
  248. "<samp>Forbidden/You don't have permission to access / on
  249. this server</samp>" message whenever I try to access my
  250. server?</a></li>
  251. <li><a href="#ie-ignores-mime">Why do my files appear
  252. correctly in Internet Explorer, but show up as source or
  253. trigger a save window with Netscape?</a></li>
  254. <li><a href="#canonical-hostnames">My site is accessible
  255. under many different hostnames; how do I redirect clients
  256. so that they see only a single name?</a></li>
  257. <li><a href="#firewall">Why can I access my website from the
  258. server or from my local network, but I can't access it from
  259. elsewhere on the Internet?</a></li>
  260. </ol>
  261. </li>
  262. </body>
  263. </html>
  264. <li value="6">
  265. <strong>Dynamic Content (CGI and SSI)</strong>
  266. <ol>
  267. <li><a href="#CGIoutsideScriptAlias">How do I enable CGI
  268. execution in directories other than the
  269. ScriptAlias?</a></li>
  270. <li><a href="#premature-script-headers">What does it mean
  271. when my CGIs fail with "<samp>Premature end of script
  272. headers</samp>"?</a></li>
  273. <li><a href="#POSTnotallowed">Why do I keep getting
  274. "Method Not Allowed" for form POST requests?</a></li>
  275. <li><a href="#nph-scripts">How can I get my script's
  276. output without Apache buffering it? Why doesn't my server
  277. push work?</a></li>
  278. <li><a href="#cgi-spec">Where can I find the "CGI
  279. specification"?</a></li>
  280. <li><a href="#fastcgi">Why isn't FastCGI included with
  281. Apache any more?</a></li>
  282. <li><a href="#ssi-part-i">How do I enable SSI (parsed
  283. HTML)?</a></li>
  284. <li><a href="#ssi-part-ii">Why don't my parsed files get
  285. cached?</a></li>
  286. <li><a href="#ssi-part-iii">How can I have my script
  287. output parsed?</a></li>
  288. <li><a href="#ssi-part-iv">SSIs don't work for
  289. VirtualHosts and/or user home directories</a></li>
  290. <li><a href="#errordocssi">How can I use
  291. <code>ErrorDocument</code> and SSI to simplify customized
  292. error messages?</a></li>
  293. <li><a href="#remote-user-var">Why is the environment
  294. variable <samp>REMOTE_USER</samp> not set?</a></li>
  295. <li><a href="#user-cgi">How do I allow each of my user
  296. directories to have a cgi-bin directory?</a></li>
  297. </ol>
  298. </li>
  299. </body>
  300. </html>
  301. <li value="7">
  302. <strong>Authentication and Access Restrictions</strong>
  303. <ol>
  304. <li><a href="#dnsauth">Why isn't restricting access by
  305. host or domain name working correctly?</a></li>
  306. <li><a href="#user-authentication">How do I set up Apache
  307. to require a username and password to access certain
  308. documents?</a></li>
  309. <li><a href="#remote-auth-only">How do I set up Apache to
  310. allow access to certain documents only if a site is
  311. either a local site <em>or</em> the user supplies a
  312. password and username?</a></li>
  313. <li><a href="#authauthoritative">Why does my
  314. authentication give me a server error?</a></li>
  315. <li><a href="#auth-on-same-machine">Do I have to keep the
  316. (mSQL) authentication information on the same
  317. machine?</a></li>
  318. <li><a href="#msql-slow">Why is my mSQL authentication
  319. terribly slow?</a></li>
  320. <li><a href="#passwdauth">Can I use my
  321. <samp>/etc/passwd</samp> file for Web page
  322. authentication?</a></li>
  323. <li><a href="#prompted-twice">Why does Apache ask for my
  324. password twice before serving a file?</a></li>
  325. </ol>
  326. </li>
  327. </body>
  328. </html>
  329. <li value="8">
  330. <strong>URL Rewriting</strong>
  331. <ol>
  332. <li><a href="#rewrite-more-config">Where can I find
  333. mod_rewrite rulesets which already solve particular
  334. URL-related problems?</a></li>
  335. <li><a href="#rewrite-article">Where can I find any
  336. published information about URL-manipulations and
  337. mod_rewrite?</a></li>
  338. <li><a href="#rewrite-complexity">Why is mod_rewrite so
  339. difficult to learn and seems so complicated?</a></li>
  340. <li><a href="#rewrite-dontwork">What can I do if my
  341. RewriteRules don't work as expected?</a></li>
  342. <li><a href="#rewrite-prefixdocroot">Why don't some of my
  343. URLs get prefixed with DocumentRoot when using
  344. mod_rewrite?</a></li>
  345. <li><a href="#rewrite-nocase">How can I make all my URLs
  346. case-insensitive with mod_rewrite?</a></li>
  347. <li><a href="#rewrite-virthost">Why are RewriteRules in
  348. my VirtualHost parts ignored?</a></li>
  349. <li><a href="#rewrite-envwhitespace">How can I use
  350. strings with whitespaces in RewriteRule's ENV
  351. flag?</a></li>
  352. </ol>
  353. </li>
  354. </body>
  355. </html>
  356. <li value="9">
  357. <strong>Features</strong>
  358. <ol>
  359. <li><a href="#proxy">Does or will Apache act as a Proxy
  360. server?</a></li>
  361. <li><a href="#multiviews">What are "multiviews"?</a></li>
  362. <li><a href="#putsupport">Why can't I publish to my
  363. Apache server using PUT on Netscape Gold and other
  364. programs?</a></li>
  365. <li><a href="#SSL-i">Why doesn't Apache include
  366. SSL?</a></li>
  367. <li><a href="#footer">How can I attach a footer to my
  368. documents without using SSI?</a></li>
  369. <li><a href="#search">Does Apache include a search
  370. engine?</a></li>
  371. <li><a href="#rotate">How can I rotate my log
  372. files?</a></li>
  373. <li><a href="#conditional-logging">How do I keep certain
  374. requests from appearing in my logs?</a></li>
  375. <li><a href="#dbinteg">Does Apache include any sort of
  376. database integration?</a></li>
  377. <li><a href="#asp">Can I use Active Server Pages (ASP)
  378. with Apache?</a></li>
  379. <li><a href="#java">Does Apache come with Java
  380. support?</a></li>
  381. </ol>
  382. </li>
  383. </body>
  384. </html>
  385. </ol>
  386. <hr />
  387. <h2>The Answers</h2>
  388. <h3>A. Background</h3>
  389. <ol>
  390. <li>
  391. <a id="what" name="what"><strong>What is
  392. Apache?</strong></a>
  393. <p>The Apache httpd server</p>
  394. <ul>
  395. <li>is a powerful, flexible, HTTP/1.1 compliant web
  396. server</li>
  397. <li>implements the latest protocols, including HTTP/1.1
  398. (RFC2616)</li>
  399. <li>is highly configurable and extensible with
  400. third-party modules</li>
  401. <li>can be customised by writing 'modules' using the
  402. Apache module API</li>
  403. <li>provides full source code and comes with an
  404. unrestrictive license</li>
  405. <li>runs on Windows NT/9x, Netware 5.x, OS/2, and most
  406. versions of Unix, as well as several other operating
  407. systems</li>
  408. <li>is actively being developed</li>
  409. <li>encourages user feedback through new ideas, bug
  410. reports and patches</li>
  411. <li>
  412. implements many frequently requested features,
  413. including:<br />
  414. <br />
  415. <dl>
  416. <dt>DBM databases for authentication</dt>
  417. <dd>allows you to easily set up password-protected
  418. pages with enormous numbers of authorized users,
  419. without bogging down the server.</dd>
  420. <dt>Customized responses to errors and problems</dt>
  421. <dd>Allows you to set up files, or even CGI scripts,
  422. which are returned by the server in response to
  423. errors and problems, e.g. setup a script to intercept
  424. <strong>500 Server Error</strong>s and perform
  425. on-the-fly diagnostics for both users and
  426. yourself.</dd>
  427. <dt>Multiple DirectoryIndex directives</dt>
  428. <dd>Allows you to say <code>DirectoryIndex index.html
  429. index.cgi</code>, which instructs the server to
  430. either send back <code>index.html</code> or run
  431. <code>index.cgi</code> when a directory URL is
  432. requested, whichever it finds in the directory.</dd>
  433. <dt>Unlimited flexible URL rewriting and
  434. aliasing</dt>
  435. <dd>Apache has no fixed limit on the numbers of
  436. Aliases and Redirects which may be declared in the
  437. config files. In addition, a powerful rewriting
  438. engine can be used to solve most URL manipulation
  439. problems.</dd>
  440. <dt>Content negotiation</dt>
  441. <dd>i.e. the ability to automatically serve clients
  442. of varying sophistication and HTML level compliance,
  443. with documents which offer the best representation of
  444. information that the client is capable of
  445. accepting.</dd>
  446. <dt>Virtual Hosts</dt>
  447. <dd>A much requested feature, sometimes known as
  448. multi-homed servers. This allows the server to
  449. distinguish between requests made to different IP
  450. addresses or names (mapped to the same machine).
  451. Apache also offers dynamically configurable
  452. mass-virtual hosting.</dd>
  453. <dt>Configurable Reliable Piped Logs</dt>
  454. <dd>You can configure Apache to generate logs in the
  455. format that you want. In addition, on most Unix
  456. architectures, Apache can send log files to a pipe,
  457. allowing for log rotation, hit filtering, real-time
  458. splitting of multiple vhosts into separate logs, and
  459. asynchronous DNS resolving on the fly.</dd>
  460. </dl>
  461. </li>
  462. </ul>
  463. <hr />
  464. </li>
  465. <li>
  466. <a id="why" name="why"><strong>How and why was Apache
  467. created?</strong></a>
  468. <p>The <a
  469. href="http://httpd.apache.org/ABOUT_APACHE.html">About
  470. Apache</a> document explains how the Apache project evolved
  471. from its beginnings as an outgrowth of the NCSA httpd
  472. project to its current status as one of the fastest, most
  473. efficient, and most functional web servers in
  474. existence.</p>
  475. <hr />
  476. </li>
  477. <li>
  478. <a id="name" name="name"><strong>Why the name
  479. "Apache"?</strong></a>
  480. <p>A cute name which stuck. Apache is "<strong>A
  481. PA</strong>t<strong>CH</strong>y server". It was based on
  482. some existing code and a series of "patch files".</p>
  483. <p>For many developers it is also a reverent connotation to
  484. the Native American Indian tribe of Apache, <a
  485. href="http://www.indians.org/welker/apache.htm">well-known
  486. for their superior skills in warfare strategy and
  487. inexhaustible endurance</a>. For more information on the
  488. Apache Nation, we suggest searching <a
  489. href="http://www.google.com/search?q=Apache+Nation">Google</a>,
  490. <a
  491. href="http://www.northernlight.com/nlquery.fcg?qr=Apache+Nation">
  492. Northernlight</a>, or <a
  493. href="http://www.alltheweb.com/cgi-bin/asearch?query=Apache+Nation">
  494. AllTheWeb</a>.</p>
  495. <hr />
  496. </li>
  497. <li>
  498. <a id="compare" name="compare"><strong>OK, so how does
  499. Apache compare to other servers?</strong></a>
  500. <p>For an independent assessment, see <a
  501. href="http://webcompare.internet.com/">Web
  502. Compare</a>.</p>
  503. <p>Apache has been shown to be substantially faster, more
  504. stable, and more feature-full than many other web servers.
  505. Although certain commercial servers have claimed to surpass
  506. Apache's speed (it has not been demonstrated that any of
  507. these "benchmarks" are a good way of measuring WWW server
  508. speed at any rate), we feel that it is better to have a
  509. mostly-fast free server than an extremely-fast server that
  510. costs thousands of dollars. Apache is run on sites that get
  511. millions of hits per day, and they have experienced no
  512. performance difficulties.</p>
  513. <hr />
  514. </li>
  515. <li>
  516. <a id="tested" name="tested"><strong>How thoroughly tested
  517. is Apache?</strong></a>
  518. <p>Apache is run on over 6 million Internet servers (as of
  519. February 2000). It has been tested thoroughly by both
  520. developers and users. The Apache Group maintains rigorous
  521. standards before releasing new versions of their server,
  522. and our server runs without a hitch on over one half of all
  523. WWW servers available on the Internet. When bugs do show
  524. up, we release patches and new versions as soon as they are
  525. available.</p>
  526. <hr />
  527. </li>
  528. <li>
  529. <a id="future" name="future"><strong>What are the future
  530. plans for Apache?</strong></a>
  531. <ul>
  532. <li>to continue to be an "open source" no-charge-for-use
  533. HTTP server,</li>
  534. <li>to keep up with advances in HTTP protocol and web
  535. developments in general,</li>
  536. <li>to collect suggestions for fixes/improvements from
  537. its users,</li>
  538. <li>to respond to needs of large volume providers as well
  539. as occasional users.</li>
  540. </ul>
  541. <hr />
  542. </li>
  543. <li>
  544. <a id="support" name="support"><strong>Whom do I contact
  545. for support?</strong></a>
  546. <p>There is no official support for Apache. None of the
  547. developers want to be swamped by a flood of trivial
  548. questions that can be resolved elsewhere. Bug reports and
  549. suggestions should be sent <em>via</em> <a
  550. href="http://httpd.apache.org/bug_report.html">the bug
  551. report page</a>. Other questions should be directed to the
  552. <a href="http://httpd.apache.org/userslist.html">Apache HTTP
  553. Server Users List</a> or the
  554. <a
  555. href="news:comp.infosystems.www.servers.unix">comp.infosystems.www.servers.unix</a>
  556. or <a
  557. href="news:comp.infosystems.www.servers.ms-windows">comp.infosystems.www.servers.ms-windows</a>
  558. newsgroup (as appropriate for the platform you use), where
  559. some of the Apache team lurk, in the company of many other
  560. httpd gurus who should be able to help.</p>
  561. <p>Commercial support for Apache is, however, available
  562. from a number of third parties.</p>
  563. <hr />
  564. </li>
  565. <li>
  566. <a id="more" name="more"><strong>Is there any more
  567. information available on Apache?</strong></a>
  568. <p>Indeed there is. See the main <a
  569. href="http://httpd.apache.org/">Apache web site</a>. There
  570. is also a regular electronic publication called <a
  571. href="http://www.apacheweek.com/" rel="Help"><cite>Apache
  572. Week</cite></a> available. Links to relevant <cite>Apache
  573. Week</cite> articles are included below where appropriate.
  574. There are also some <a
  575. href="http://httpd.apache.org/info/apache_books.html">Apache-specific
  576. books</a> available.</p>
  577. <hr />
  578. </li>
  579. <li>
  580. <a id="where" name="where"><strong>Where can I get
  581. Apache?</strong></a>
  582. <p>You can find out how to download the source for Apache
  583. at the project's <a href="http://httpd.apache.org/">main
  584. web page</a>.</p>
  585. <hr />
  586. </li>
  587. <li>
  588. <a id="logo" name="logo"><b>May I use the Apache logo on my
  589. product or Web site?</b></a>
  590. <p>You may <b>NOT</b> use any original artwork from the
  591. Apache Software Foundation, nor make or use modified
  592. versions of such artwork, except under the following
  593. conditions:</p>
  594. <ul>
  595. <li>You may use the <a
  596. href="../../apache_pb.gif">'Powered by Apache'
  597. graphic</a> on a Web site that is being served by the
  598. Apache HTTP server software.</li>
  599. <li>You may use the aforementioned 'Powered by Apache'
  600. graphic or the <a
  601. href="http://www.apache.org/images/asf_logo.gif">
  602. Apache Software Foundation logo</a> in product
  603. description and promotional material <b>IF and ONLY
  604. IF</b> such use can in no way be interpreted as anything
  605. other than an attribution. Using the Apache name and
  606. artwork in a manner that implies endorsement of a product
  607. or service is <b>strictly forbidden</b>.</li>
  608. </ul>
  609. <hr />
  610. </li>
  611. </ol>
  612. </body>
  613. </html>
  614. <h3>B. General Technical Questions</h3>
  615. <ol>
  616. <li>
  617. <a id="what2do" name="what2do"><strong>"Why can't I ...?
  618. Why won't ... work?" What to do in case of
  619. problems</strong></a>
  620. <p>If you are having trouble with your Apache server
  621. software, you should take the following steps:</p>
  622. <ol>
  623. <li>
  624. <strong>Check the errorlog!</strong>
  625. <p>Apache tries to be helpful when it encounters a
  626. problem. In many cases, it will provide some details by
  627. writing one or messages to the server error log.
  628. Sometimes this is enough for you to diagnose &amp; fix
  629. the problem yourself (such as file permissions or the
  630. like). The default location of the error log is
  631. <samp>/usr/local/apache/logs/error_log</samp>, but see
  632. the <a
  633. href="../mod/core.html#errorlog"><samp>ErrorLog</samp></a>
  634. directive in your config files for the location on your
  635. server.</p>
  636. </li>
  637. <li>
  638. <strong>Check the <a
  639. href="http://httpd.apache.org/docs/misc/FAQ.html">FAQ</a>!</strong>
  640. <p>The latest version of the Apache Frequently-Asked
  641. Questions list can always be found at the main Apache
  642. web site.</p>
  643. </li>
  644. <li>
  645. <strong>Check the Apache bug database</strong>
  646. <p>Most problems that get reported to The Apache Group
  647. are recorded in the <a
  648. href="http://bugs.apache.org/">bug database</a>.
  649. <em><strong>Please</strong> check the existing reports,
  650. open <strong>and</strong> closed, before adding
  651. one.</em> If you find that your issue has already been
  652. reported, please <em>don't</em> add a "me, too" report.
  653. If the original report isn't closed yet, we suggest
  654. that you check it periodically. You might also consider
  655. contacting the original submitter, because there may be
  656. an email exchange going on about the issue that isn't
  657. getting recorded in the database.</p>
  658. </li>
  659. <li>
  660. <strong>Ask in a user support group.</strong>
  661. <p>A lot of common problems never make it to the bug
  662. database because there's already high Q&amp;A traffic
  663. about them in the <a
  664. href="http://httpd.apache.org/userslist.html">Users
  665. mailing list</a> or <a
  666. href="news:comp.infosystems.www.servers.unix"><samp>comp.infosystems.www.servers.unix</samp></a>
  667. and related newsgroups. These newsgroups are also
  668. available via <a
  669. href="http://groups.google.com/groups?group=comp.infosystems.www.servers">
  670. Google</a>. Many Apache users, and some of the developers,
  671. can be found roaming their virtual halls, so it is suggested
  672. that you seek wisdom there. The chances are good that
  673. you'll get a faster answer there than from the bug
  674. database, even if you <em>don't</em> see your question
  675. already posted.</p>
  676. </li>
  677. <li>
  678. <strong>If all else fails, report the problem in the
  679. bug database</strong>
  680. <p>If you've gone through those steps above that are
  681. appropriate and have obtained no relief, then please
  682. <em>do</em> let The Apache Group know about the problem
  683. by <a
  684. href="http://httpd.apache.org/bug_report.html">logging
  685. a bug report</a>.</p>
  686. <p>If your problem involves the server crashing and
  687. generating a core dump, please include a backtrace (if
  688. possible). As an example,</p>
  689. <dl>
  690. <dd><code># cd <em>ServerRoot</em><br />
  691. # dbx httpd core<br />
  692. (dbx) where</code></dd>
  693. </dl>
  694. <p>(Substitute the appropriate locations for your
  695. <samp>ServerRoot</samp> and your <samp>httpd</samp> and
  696. <samp>core</samp> files. You may have to use
  697. <code>gdb</code> instead of <code>dbx</code>.)</p>
  698. </li>
  699. </ol>
  700. <hr />
  701. </li>
  702. <li>
  703. <a id="compatible" name="compatible"><strong>How compatible
  704. is Apache with my existing NCSA 1.3 setup?</strong></a>
  705. <p>Apache attempts to offer all the features and
  706. configuration options of NCSA httpd 1.3, as well as many of
  707. the additional features found in NCSA httpd 1.4 and NCSA
  708. httpd 1.5.</p>
  709. <p>NCSA httpd appears to be moving toward adding
  710. experimental features which are not generally required at
  711. the moment. Some of the experiments will succeed while
  712. others will inevitably be dropped. The Apache philosophy is
  713. to add what's needed as and when it is needed.</p>
  714. <p>Friendly interaction between Apache and NCSA developers
  715. should ensure that fundamental feature enhancements stay
  716. consistent between the two servers for the foreseeable
  717. future.</p>
  718. <hr />
  719. </li>
  720. <li>
  721. <a id="year2000" name="year2000"><strong>Is Apache Year
  722. 2000 compliant?</strong></a>
  723. <p>Yes, Apache is Year 2000 compliant.</p>
  724. <p>Apache internally never stores years as two digits. On
  725. the HTTP protocol level RFC1123-style addresses are
  726. generated which is the only format a HTTP/1.1-compliant
  727. server should generate. To be compatible with older
  728. applications Apache recognizes ANSI C's
  729. <code>asctime()</code> and RFC850-/RFC1036-style date
  730. formats, too. The <code>asctime()</code> format uses
  731. four-digit years, but the RFC850 and RFC1036 date formats
  732. only define a two-digit year. If Apache sees such a date
  733. with a value less than 70 it assumes that the century is
  734. <samp>20</samp> rather than <samp>19</samp>.</p>
  735. <p>Although Apache is Year 2000 compliant, you may still
  736. get problems if the underlying OS has problems with dates
  737. past year 2000 (<em>e.g.</em>, OS calls which accept or
  738. return year numbers). Most (UNIX) systems store dates
  739. internally as signed 32-bit integers which contain the
  740. number of seconds since 1<sup>st</sup> January 1970, so the
  741. magic boundary to worry about is the year 2038 and not
  742. 2000. But modern operating systems shouldn't cause any
  743. trouble at all.</p>
  744. <p>Users of Apache 1.2.x should upgrade to a current
  745. version of Apache 1.3 (see <a
  746. href="../new_features_1_3.html#misc">year-2000 improvements
  747. in Apache 1.3</a> for details).</p>
  748. <p>The Apache HTTP Server project is an open-source
  749. software product of the Apache Software Foundation. The
  750. project and the Foundation <b>cannot</b> offer legal
  751. assurances regarding any suitability of the software for
  752. your application. There are several commercial Apache
  753. support organizations and derivative server products
  754. available that may be able to stand behind the software and
  755. provide you with any assurances you may require. You may
  756. find links to some of these vendors at <samp>&lt;<a
  757. href="http://www.apache.org/info/support.cgi">http://www.apache.org/info/support.cgi</a>&gt;</samp>.</p>
  758. <p>The Apache HTTP server software is distributed with the
  759. following disclaimer, found in the software license:</p>
  760. <pre>
  761. THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
  762. EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  763. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  764. PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
  765. ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  766. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  767. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  768. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  769. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  770. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  771. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  772. OF THE POSSIBILITY OF SUCH DAMAGE.
  773. </pre>
  774. <hr />
  775. </li>
  776. <li>
  777. <a id="submit_patch" name="submit_patch"><strong>How do I
  778. submit a patch to the Apache Group?</strong></a>
  779. <p>The Apache Group encourages patches from outside
  780. developers. There are 2 main "types" of patches: small
  781. bugfixes and general improvements. Bugfixes should be
  782. submitting using the Apache <a
  783. href="http://httpd.apache.org/bug_report.html">bug report
  784. page</a>. Improvements, modifications, and additions should
  785. follow the instructions below.</p>
  786. <p>In general, the first course of action is to be a member
  787. of the <samp>dev@httpd.apache.org</samp> mailing list. This
  788. indicates to the Group that you are closely following the
  789. latest Apache developments. Your patch file should be
  790. generated using either '<code>diff&nbsp;-c</code>' or
  791. '<code>diff&nbsp;-u</code>' against the latest CVS tree. To
  792. submit your patch, send email to
  793. <samp>dev@httpd.apache.org</samp> with a
  794. <samp>Subject:</samp> line that starts with
  795. <samp>[PATCH]</samp> and includes a general description of
  796. the patch. In the body of the message, the patch should be
  797. clearly described and then included at the end of the
  798. message. If the patch-file is long, you can note a URL to
  799. the file instead of the file itself. Use of MIME
  800. enclosures/attachments should be avoided.</p>
  801. <p>Be prepared to respond to any questions about your
  802. patches and possibly defend your code. If your patch
  803. results in a lot of discussion, you may be asked to submit
  804. an updated patch that incorporate all changes and
  805. suggestions.</p>
  806. <hr />
  807. </li>
  808. <li>
  809. <a id="domination" name="domination"><strong>Why has Apache
  810. stolen my favourite site's Internet address?</strong></a>
  811. <p>The simple answer is: "It hasn't." This misconception is
  812. usually caused by the site in question having migrated to
  813. the Apache Web server software, but not having migrated the
  814. site's content yet. When Apache is installed, the default
  815. page that gets installed tells the Webmaster the
  816. installation was successful. The expectation is that this
  817. default page will be replaced with the site's real content.
  818. If it doesn't, complain to the Webmaster, not to the Apache
  819. project -- we just make the software and aren't responsible
  820. for what people do (or don't do) with it.</p>
  821. <hr />
  822. </li>
  823. <li>
  824. <a id="apspam" name="apspam"><strong>Why am I getting spam
  825. mail from the Apache site?</strong></a>
  826. <p>The short answer is: "You aren't." Usually when someone
  827. thinks the Apache site is originating spam, it's because
  828. they've traced the spam to a Web site, and the Web site
  829. says it's using Apache. See the <a
  830. href="#domination">previous FAQ entry</a> for more details
  831. on this phenomenon.</p>
  832. <p>No marketing spam originates from the Apache site. The
  833. only mail that comes from the site goes only to addresses
  834. that have been <em>requested</em> to receive the mail.</p>
  835. <hr />
  836. </li>
  837. <li>
  838. <a id="redist" name="redist"><strong>May I include the
  839. Apache software on a CD or other package I'm
  840. distributing?</strong></a>
  841. <p>The detailed answer to this question can be found in the
  842. Apache license, which is included in the Apache
  843. distribution in the file <code>LICENSE</code>. You can also
  844. find it on the Web at <samp>&lt;<a
  845. href="http://www.apache.org/LICENSE.txt">http://www.apache.org/LICENSE.txt</a>&gt;</samp>.</p>
  846. <hr />
  847. </li>
  848. <li>
  849. <a id="zoom" name="zoom"><strong>What's the best
  850. hardware/operating system/... How do I get the most out of
  851. my Apache Web server?</strong></a>
  852. <p>Check out Dean Gaudet's <a
  853. href="perf-tuning.html">performance tuning page</a>.</p>
  854. <hr />
  855. </li>
  856. <li>
  857. <a id="regex" name="regex"><strong>What are "regular
  858. expressions"?</strong></a>
  859. <p>Regular expressions are a way of describing a pattern -
  860. for example, "all the words that begin with the letter A"
  861. or "every 10-digit phone number" or even "Every sentence
  862. with two commas in it, and no capital letter Q". Regular
  863. expressions (aka "regex"s) are useful in Apache because
  864. they let you apply certain attributes against collections
  865. of files or resources in very flexible ways - for example,
  866. all .gif and .jpg files under any "images" directory could
  867. be written as /\/images\/.*(jpg|gif)$/.</p>
  868. <p>The best overview around is probably the one which comes
  869. with Perl. We implement a simple subset of Perl's regex
  870. support, but it's still a good way to learn what they mean.
  871. You can start by going to the <a
  872. href="http://www.perl.com/CPAN-local/doc/manual/html/pod/perlre.html#Regular_Expressions">
  873. CPAN page on regular expressions</a>, and branching out
  874. from there.</p>
  875. <hr />
  876. </li>
  877. <li>
  878. <a id="binaries" name="binaries"><b>Why isn't there a
  879. binary for my platform?</b></a>
  880. <p>The developers make sure that the software builds and
  881. works correctly on the platforms available to them; this
  882. does <i>not</i> necessarily mean that <i>your</i> platform
  883. is one of them. In addition, the Apache HTTP server project
  884. is primarily source oriented, meaning that distributing
  885. valid and buildable source code is the purpose of a
  886. release, not making sure that there is a binary package for
  887. all of the supported platforms.</p>
  888. <p>If you don't see a kit for your platform listed in the
  889. binary distribution area (&lt;URL:<a
  890. href="http://httpd.apache.org/dist/httpd/binaries/">http://httpd.apache.org/dist/httpd/binaries/</a>&gt;),
  891. it means either that the platform isn't available to any of
  892. the developers, or that they just haven't gotten around to
  893. preparing a binary for it. As this is a voluntary project,
  894. they are under no obligation to do so. Users are encouraged
  895. and expected to build the software themselves.</p>
  896. <p>The sole exception to these practices is the Windows
  897. package. Unlike most Unix and Unix-like platforms, Windows
  898. systems do not come with a bundled software development
  899. environment, so we <i>do</i> prepare binary kits for
  900. Windows when we make a release. Again, however, it's a
  901. voluntary thing and only a limited number of the developers
  902. have the capability to build the InstallShield package, so
  903. the Windows release may lag somewhat behind the source
  904. release. This lag should be no more than a few days at
  905. most.</p>
  906. <hr />
  907. </li>
  908. </ol>
  909. </body>
  910. </html>
  911. <h3>C. Building Apache</h3>
  912. <ol>
  913. <li>
  914. <a id="bind8.1" name="bind8.1"><strong>Why do I get an
  915. error about an undefined reference to
  916. "<samp>__inet_ntoa</samp>" or other <samp>__inet_*</samp>
  917. symbols?</strong></a>
  918. <p>If you have installed <a
  919. href="http://www.isc.org/bind.html">BIND-8</a> then this is
  920. normally due to a conflict between your include files and
  921. your libraries. BIND-8 installs its include files and
  922. libraries <code>/usr/local/include/</code> and
  923. <code>/usr/local/lib/</code>, while the resolver that comes
  924. with your system is probably installed in
  925. <code>/usr/include/</code> and <code>/usr/lib/</code>. If
  926. your system uses the header files in
  927. <code>/usr/local/include/</code> before those in
  928. <code>/usr/include/</code> but you do not use the new
  929. resolver library, then the two versions will conflict.</p>
  930. <p>To resolve this, you can either make sure you use the
  931. include files and libraries that came with your system or
  932. make sure to use the new include files and libraries.
  933. Adding <code>-lbind</code> to the
  934. <code>EXTRA_LDFLAGS</code> line in your
  935. <samp>Configuration</samp> file, then re-running
  936. <samp>Configure</samp>, should resolve the problem. (Apache
  937. versions 1.2.* and earlier use <code>EXTRA_LFLAGS</code>
  938. instead.)</p>
  939. <p><strong>Note:</strong>As of BIND 8.1.1, the bind
  940. libraries and files are installed under
  941. <samp>/usr/local/bind</samp> by default, so you should not
  942. run into this problem. Should you want to use the bind
  943. resolvers you'll have to add the following to the
  944. respective lines:</p>
  945. <dl>
  946. <dd><code>EXTRA_CFLAGS=-I/usr/local/bind/include<br />
  947. EXTRA_LDFLAGS=-L/usr/local/bind/lib<br />
  948. EXTRA_LIBS=-lbind</code></dd>
  949. </dl>
  950. <hr />
  951. </li>
  952. <li>
  953. <a id="cantbuild" name="cantbuild"><strong>Why won't Apache
  954. compile with my system's <samp>cc</samp>?</strong></a>
  955. <p>If the server won't compile on your system, it is
  956. probably due to one of the following causes:</p>
  957. <ul>
  958. <li><strong>The <samp>Configure</samp> script doesn't
  959. recognize your system environment.</strong><br />
  960. This might be either because it's completely unknown or
  961. because the specific environment (include files, OS
  962. version, <em>et cetera</em>) isn't explicitly handled. If
  963. this happens, you may need to port the server to your OS
  964. yourself.</li>
  965. <li><strong>Your system's C compiler is
  966. garbage.</strong><br />
  967. Some operating systems include a default C compiler that
  968. is either not ANSI C-compliant or suffers from other
  969. deficiencies. The usual recommendation in cases like this
  970. is to acquire, install, and use <samp>gcc</samp>.</li>
  971. <li><strong>Your <samp>include</samp> files may be
  972. confused.</strong><br />
  973. In some cases, we have found that a compiler
  974. installation or system upgrade has left the C header
  975. files in an inconsistent state. Make sure that your
  976. include directory tree is in sync with the compiler and
  977. the operating system.</li>
  978. <li><strong>Your operating system or compiler may be out
  979. of revision.</strong><br />
  980. Software vendors (including those that develop operating
  981. systems) issue new releases for a reason; sometimes to
  982. add functionality, but more often to fix bugs that have
  983. been discovered. Try upgrading your compiler and/or your
  984. operating system.</li>
  985. </ul>
  986. <p>The Apache Group tests the ability to build the server
  987. on many different platforms. Unfortunately, we can't test
  988. all of the OS platforms there are. If you have verified
  989. that none of the above issues is the cause of your problem,
  990. and it hasn't been reported before, please submit a <a
  991. href="http://httpd.apache.org/bug_report.html">problem
  992. report</a>. Be sure to include <em>complete</em> details,
  993. such as the compiler &amp; OS versions and exact error
  994. messages.</p>
  995. <hr />
  996. </li>
  997. <li>
  998. <a id="linuxiovec" name="linuxiovec"><strong>Why do I get
  999. complaints about redefinition of "<code>struct
  1000. iovec</code>" when compiling under Linux?</strong></a>
  1001. <p>This is a conflict between your C library includes and
  1002. your kernel includes. You need to make sure that the
  1003. versions of both are matched properly. There are two
  1004. workarounds, either one will solve the problem:</p>
  1005. <ul>
  1006. <li>Remove the definition of <code>struct iovec</code>
  1007. from your C library includes. It is located in
  1008. <code>/usr/include/sys/uio.h</code>.
  1009. <strong>Or,</strong></li>
  1010. <li>Add <code>-DNO_WRITEV</code> to the
  1011. <code>EXTRA_CFLAGS</code> line in your
  1012. <samp>Configuration</samp> and reconfigure/rebuild. This
  1013. hurts performance and should only be used as a last
  1014. resort.</li>
  1015. </ul>
  1016. <hr />
  1017. </li>
  1018. <li>
  1019. <a id="broken-gcc" name="broken-gcc"><strong>I'm using gcc
  1020. and I get some compilation errors, what is
  1021. wrong?</strong></a>
  1022. <p>GCC parses your system header files and produces a
  1023. modified subset which it uses for compiling. This behavior
  1024. ties GCC tightly to the version of your operating system.
  1025. So, for example, if you were running IRIX 5.3 when you
  1026. built GCC and then upgrade to IRIX 6.2 later, you will have
  1027. to rebuild GCC. Similarly for Solaris 2.4, 2.5, or 2.5.1
  1028. when you upgrade to 2.6. Sometimes you can type "gcc -v"
  1029. and it will tell you the version of the operating system it
  1030. was built against.</p>
  1031. <p>If you fail to do this, then it is very likely that
  1032. Apache will fail to build. One of the most common errors is
  1033. with <code>readv</code>, <code>writev</code>, or
  1034. <code>uio.h</code>. This is <strong>not</strong> a bug with
  1035. Apache. You will need to re-install GCC.</p>
  1036. <hr />
  1037. </li>
  1038. <li>
  1039. <a id="glibc-crypt" name="glibc-crypt"><strong>I'm using
  1040. RedHat Linux 5.0, or some other <samp>glibc</samp>-based
  1041. Linux system, and I get errors with the <code>crypt</code>
  1042. function when I attempt to build Apache 1.2.</strong></a>
  1043. <p><samp>glibc</samp> puts the <code>crypt</code> function
  1044. into a separate library. Edit your
  1045. <code>src/Configuration</code> file and set this:</p>
  1046. <dl>
  1047. <dd><code>EXTRA_LIBS=-lcrypt</code></dd>
  1048. </dl>
  1049. <p>Then re-run <samp>src/Configure</samp> and re-execute
  1050. the make.</p>
  1051. <hr />
  1052. </li>
  1053. </ol>
  1054. </body>
  1055. </html>
  1056. <h3>D. Error Log Messages and Problems Starting Apache</h3>
  1057. <ol>
  1058. <li>
  1059. <a id="setgid" name="setgid"><strong>Why do I get
  1060. "<samp>setgid: Invalid argument</samp>" at
  1061. startup?</strong></a>
  1062. <p>Your <a
  1063. href="../mod/core.html#group"><samp>Group</samp></a>
  1064. directive (probably in <samp>conf/httpd.conf</samp>) needs
  1065. to name a group that actually exists in the
  1066. <samp>/etc/group</samp> file (or your system's equivalent).
  1067. This problem is also frequently seen when a negative number
  1068. is used in the <code>Group</code> directive (<em>e.g.</em>,
  1069. "<code>Group&nbsp;#-1</code>"). Using a group name -- not
  1070. group number -- found in your system's group database
  1071. should solve this problem in all cases.</p>
  1072. <hr />
  1073. </li>
  1074. <li>
  1075. <a id="nodelay" name="nodelay"><strong>Why am I getting
  1076. "<samp>httpd: could not set socket option
  1077. TCP_NODELAY</samp>" in my error log?</strong></a>
  1078. <p>This message almost always indicates that the client
  1079. disconnected before Apache reached the point of calling
  1080. <code>setsockopt()</code> for the connection. It shouldn't
  1081. occur for more than about 1% of the requests your server
  1082. handles, and it's advisory only in any case.</p>
  1083. <hr />
  1084. </li>
  1085. <li>
  1086. <a id="peerreset" name="peerreset"><strong>Why am I getting
  1087. "<samp>connection reset by peer</samp>" in my error
  1088. log?</strong></a>
  1089. <p>This is a normal message and nothing about which to be
  1090. alarmed. It simply means that the client canceled the
  1091. connection before it had been completely set up - such as
  1092. by the end-user pressing the "Stop" button. People's
  1093. patience being what it is, sites with response-time
  1094. problems or slow network links may experiences this more
  1095. than high-capacity ones or those with large pipes to the
  1096. network.</p>
  1097. <hr />
  1098. </li>
  1099. <li>
  1100. <a id="wheres-the-dump" name="wheres-the-dump"><strong>The
  1101. errorlog says Apache dumped core, but where's the dump
  1102. file?</strong></a>
  1103. <p>In Apache version 1.2, the error log message about
  1104. dumped core includes the directory where the dump file
  1105. should be located. However, many Unixes do not allow a
  1106. process that has called <code>setuid()</code> to dump core
  1107. for security reasons; the typical Apache setup has the
  1108. server started as root to bind to port 80, after which it
  1109. changes UIDs to a non-privileged user to serve
  1110. requests.</p>
  1111. <p>Dealing with this is extremely operating
  1112. system-specific, and may require rebuilding your system
  1113. kernel. Consult your operating system documentation or
  1114. vendor for more information about whether your system does
  1115. this and how to bypass it. If there <em>is</em> a
  1116. documented way of bypassing it, it is recommended that you
  1117. bypass it only for the <samp>httpd</samp> server process if
  1118. possible.</p>
  1119. <p>The canonical location for Apache's core-dump files is
  1120. the <a href="../mod/core.html#serverroot">ServerRoot</a>
  1121. directory. As of Apache version 1.3, the location can be
  1122. set <em>via</em> the <a
  1123. href="../mod/core.html#coredumpdirectory"><samp>CoreDumpDirectory</samp></a>
  1124. directive to a different directory. Make sure that this
  1125. directory is writable by the user the server runs as (as
  1126. opposed to the user the server is <em>started</em> as).</p>
  1127. <hr />
  1128. </li>
  1129. <li>
  1130. <a id="linux-shmget" name="linux-shmget"><strong>When I run
  1131. it under Linux I get "shmget: function not found", what
  1132. should I do?</strong></a>
  1133. <p>Your kernel has been built without SysV IPC support. You
  1134. will have to rebuild the kernel with that support enabled
  1135. (it's under the "General Setup" submenu). Documentation for
  1136. kernel building is beyond the scope of this FAQ; you should
  1137. consult the <a
  1138. href="http://www.redhat.com/mirrors/LDP/HOWTO/Kernel-HOWTO.html">
  1139. Kernel HOWTO</a>, or the documentation provided with your
  1140. distribution, or a <a
  1141. href="http://www.redhat.com/mirrors/LDP/HOWTO/META-FAQ.html">
  1142. Linux newsgroup/mailing list</a>. As a last-resort
  1143. workaround, you can comment out the
  1144. <code>#define&nbsp;USE_SHMGET_SCOREBOARD</code> definition
  1145. in the <samp>LINUX</samp> section of
  1146. <samp>src/conf.h</samp> and rebuild the server (prior to
  1147. 1.3b4, simply removing
  1148. <code>#define&nbsp;HAVE_SHMGET</code> would have sufficed).
  1149. This will produce a server which is slower and less
  1150. reliable.</p>
  1151. <hr />
  1152. </li>
  1153. <li>
  1154. <a id="nfslocking" name="nfslocking"><strong>Server hangs,
  1155. or fails to start, and/or error log fills with
  1156. "<samp>fcntl: F_SETLKW: No record locks available</samp>"
  1157. or similar messages</strong></a>
  1158. <p>These are symptoms of a fine locking problem, which
  1159. usually means that the server is trying to use a
  1160. synchronization file on an NFS filesystem.</p>
  1161. <p>Because of its parallel-operation model, the Apache Web
  1162. server needs to provide some form of synchronization when
  1163. accessing certain resources. One of these synchronization
  1164. methods involves taking out locks on a file, which means
  1165. that the filesystem whereon the lockfile resides must
  1166. support locking. In many cases this means it <em>can't</em>
  1167. be kept on an NFS-mounted filesystem.</p>
  1168. <p>To cause the Web server to work around the NFS locking
  1169. limitations, include a line such as the following in your
  1170. server configuration files:</p>
  1171. <dl>
  1172. <dd><code>LockFile /var/run/apache-lock</code></dd>
  1173. </dl>
  1174. <p>The directory should not be generally writable
  1175. (<em>e.g.</em>, don't use <samp>/var/tmp</samp>). See the
  1176. <a
  1177. href="../mod/core.html#lockfile"><samp>LockFile</samp></a>
  1178. documentation for more information.</p>
  1179. <hr />
  1180. </li>
  1181. <li>
  1182. <a id="aixccbug" name="aixccbug"><strong>Why am I getting
  1183. "<samp>Expected &lt;/Directory&gt; but saw
  1184. &lt;/Directory&gt;</samp>" when I try to start
  1185. Apache?</strong></a>
  1186. <p>This is a known problem with certain versions of the AIX
  1187. C compiler. IBM are working on a solution, and the issue is
  1188. being tracked by <a
  1189. href="http://bugs.apache.org/index/full/2312">problem
  1190. report #2312</a>.</p>
  1191. <hr />
  1192. </li>
  1193. <li>
  1194. <a id="redhat" name="redhat"><strong>I'm using RedHat Linux
  1195. and I have problems with httpd dying randomly or not
  1196. restarting properly</strong></a>
  1197. <p>RedHat Linux versions 4.x (and possibly earlier) RPMs
  1198. contain various nasty scripts which do not stop or restart
  1199. Apache properly. These can affect you even if you're not
  1200. running the RedHat supplied RPMs.</p>
  1201. <p>If you're using the default install then you're probably
  1202. running Apache 1.1.3, which is outdated. From RedHat's ftp
  1203. site you can pick up a more recent RPM for Apache 1.2.x.
  1204. This will solve one of the problems.</p>
  1205. <p>If you're using a custom built Apache rather than the
  1206. RedHat RPMs then you should <code>rpm -e apache</code>. In
  1207. particular you want the mildly broken
  1208. <code>/etc/logrotate.d/apache</code> script to be removed,
  1209. and you want the broken <code>/etc/rc.d/init.d/httpd</code>
  1210. (or <code>httpd.init</code>) script to be removed. The
  1211. latter is actually fixed by the apache-1.2.5 RPMs but if
  1212. you're building your own Apache then you probably don't
  1213. want the RedHat files.</p>
  1214. <p>We can't stress enough how important it is for folks,
  1215. <em>especially vendors</em> to follow the <a
  1216. href="../stopping.html">stopping Apache directions</a>
  1217. given in our documentation. In RedHat's defense, the broken
  1218. scripts were necessary with Apache 1.1.x because the Linux
  1219. support in 1.1.x was very poor, and there were various race
  1220. conditions on all platforms. None of this should be
  1221. necessary with Apache 1.2 and later.</p>
  1222. <hr />
  1223. </li>
  1224. <li>
  1225. <a id="stopping" name="stopping"><strong>I upgraded from an
  1226. Apache version earlier than 1.2.0 and suddenly I have
  1227. problems with Apache dying randomly or not restarting
  1228. properly</strong></a>
  1229. <p>You should read <a href="#redhat">the previous note</a>
  1230. about problems with RedHat installations. It is entirely
  1231. likely that your installation has start/stop/restart
  1232. scripts which were built for an earlier version of Apache.
  1233. Versions earlier than 1.2.0 had various race conditions
  1234. that made it necessary to use <code>kill -9</code> at times
  1235. to take out all the httpd servers. But that should not be
  1236. necessary any longer. You should follow the <a
  1237. href="../stopping.html">directions on how to stop and
  1238. restart Apache</a>.</p>
  1239. <p>As of Apache 1.3 there is a script
  1240. <code>src/support/apachectl</code> which, after a bit of
  1241. customization, is suitable for starting, stopping, and
  1242. restarting your server.</p>
  1243. <hr />
  1244. </li>
  1245. <li>
  1246. <a id="setservername" name="setservername"><b>When I try to
  1247. start Apache from a DOS window, I get a message like
  1248. "<samp>Cannot determine host name. Use ServerName directive
  1249. to set it manually.</samp>" What does this mean?</b></a>
  1250. <p>It means what it says; the Apache software can't
  1251. determine the hostname of your system. Edit your
  1252. <samp>conf\httpd.conf</samp> file, look for the string
  1253. "ServerName", and make sure there's an uncommented
  1254. directive such as</p>
  1255. <dl>
  1256. <dd><code>ServerName localhost</code></dd>
  1257. </dl>
  1258. <p>or</p>
  1259. <dl>
  1260. <dd><code>ServerName www.foo.com</code></dd>
  1261. </dl>
  1262. <p>in the file. Correct it if there one there with wrong
  1263. information, or add one if you don't already have one.</p>
  1264. <p>Also, make sure that your Windows system has DNS
  1265. enabled. See the TCP/IP setup component of the Networking
  1266. or Internet Options control panel.</p>
  1267. <p>After verifying that DNS is enabled and that you have a
  1268. valid hostname in your <samp>ServerName</samp> directive,
  1269. try to start the server again.</p>
  1270. <hr />
  1271. </li>
  1272. <li>
  1273. <a id="ws2_32dll" name="ws2_32dll"><b>When I try to start
  1274. Apache for Windows, I get a message like "<samp>Unable To
  1275. Locate WS2_32.DLL...</samp>". What should I do?</b></a>
  1276. <p>Short answer: You need to install Winsock 2, available
  1277. from <a
  1278. href="http://www.microsoft.com/windows95/downloads/">http://www.microsoft.com/windows95/downloads/</a></p>
  1279. <p>Detailed answer: Prior to version 1.3.9, Apache for
  1280. Windows used Winsock 1.1. Beginning with version 1.3.9,
  1281. Apache began using Winsock 2 features (specifically,
  1282. WSADuplicateSocket()). WS2_32.DLL implements the Winsock 2
  1283. API. Winsock 2 ships with Windows NT 4.0 and Windows 98.
  1284. Some of the earlier releases of Windows 95 did not include
  1285. Winsock 2.</p>
  1286. <hr />
  1287. </li>
  1288. <li>
  1289. <a id="WSADuplicateSocket"
  1290. name="WSADuplicateSocket"><b>Apache for Windows does not
  1291. start. Error log contains this message: "<samp>[crit]
  1292. (10045) The attempted operation is not supported for the
  1293. type of object referenced: Parent: WSADuplicateSocket
  1294. failed for socket ###</samp>". What does this mean?</b></a>
  1295. <p>We have seen this problem when Apache is run on systems
  1296. along with Virtual Private Networking clients like Aventail
  1297. Connect. Aventail Connect is a Layered Service Provider
  1298. (LSP) that inserts itself, as a "shim," between the Winsock
  1299. 2 API and Window's native Winsock 2 implementation. The
  1300. Aventail Connect shim does not implement
  1301. WSADuplicateSocket, which is the cause of the failure.</p>
  1302. <p>The shim is not unloaded when Aventail Connect is shut
  1303. down. Once observed, the problem persists until the shim is
  1304. either explicitly unloaded or the machine is rebooted.
  1305. Instructions for temporarily removing the Aventail Connect
  1306. V3.x shim can be found here: "<a
  1307. href="http://support.aventail.com/akb/article00386.html">How
  1308. to Remove Aventail Connect v3.x from the LSP Order for
  1309. Testing Purposes</a>."</p>
  1310. <p>Another potential solution (not tested) is to add
  1311. <code>apache.exe</code> to the Aventail "Connect Exclusion
  1312. List". See this link for details: "<a
  1313. href="http://support.aventail.com/akb/article00586.html">How
  1314. to Add an Application to Aventail Connect's Application
  1315. Exclusion List</a>."</p>
  1316. <p>Apache is affected in a similar way by <em>any</em>
  1317. firewall program that isn't correctly configured. Assure
  1318. you exclude your Apache server ports (usually port 80) from
  1319. the list of ports to block. Refer to your firewall
  1320. program's documentation for the how-to.</p>
  1321. <hr />
  1322. </li>
  1323. <li>
  1324. <a id="err1067" name="err1067"><b>When I try to start
  1325. Apache on Windows, I get a message like "<code>System error
  1326. 1067 has occurred. The process terminated
  1327. unexpectedly</code>." What does this mean?</b></a>
  1328. <p>This message means that the Web server was unable to
  1329. start correctly for one reason or another. To find out why,
  1330. execute the following commands in a DOS window:</p>
  1331. <pre>
  1332. c:
  1333. cd "\Program Files\Apache Group\Apache"
  1334. apache
  1335. </pre>
  1336. <p>(If you don't get the prompt back, hit Control-C to
  1337. cause Apache to exit.)</p>
  1338. <p>The error you see will probably be one of those
  1339. preceding this question in the FAQ.</p>
  1340. <p>As of Apache 1.3.14, first check the Windows NT Event
  1341. Log for Application errors using the Windows NT/2000 Event
  1342. Viewer program. Any errors that occur prior to opening the
  1343. Apache error log will be stored here, if Apache is run as a
  1344. Service on NT or 2000. As with any error, also check your
  1345. Apache error log.</p>
  1346. <hr />
  1347. </li>
  1348. <li><a id="suseFDN" name="suseFDN"><b>On a SuSE Linux system, I try and
  1349. configure access control using basic authentication.
  1350. Although I follow the example exactly, authentication
  1351. fails, and an error message "<code>admin: not a valid
  1352. FDN: ....</code>" is logged.</b></a>
  1353. <p>
  1354. In the SuSE distribution, additional 3rd party authentication
  1355. modules have been added and activated by default. These modules
  1356. interfere with the Apache standard modules and cause Basic
  1357. authentication to fail. Our recommendation is to comment all
  1358. those modules in <code>/etc/httpd/suse_addmodule.conf</code>
  1359. and <code>/etc/httpd/suse_loadmodule.conf</code> which are not
  1360. actually required for running your server.
  1361. </p><hr />
  1362. </li>
  1363. <li><a id="codered" name="codered"><b>Why do I have weird entries in my
  1364. logs asking for <code>default.ida</code> and
  1365. <code>cmd.exe</code>?</b></a>
  1366. <p>The host requesting pages from your website and creating
  1367. those entries is a Windows machine running IIS that has been
  1368. infected by an Internet worm such as Nimda or Code Red. You
  1369. can safely ignore these error messages as they do not affect
  1370. Apache. ApacheWeek has an <a
  1371. href="http://www.apacheweek.com/features/codered">article</a>
  1372. with more information.</p>
  1373. </li>
  1374. </ol>
  1375. </body>
  1376. </html>
  1377. <h3>E. Configuration Questions</h3>
  1378. <ol>
  1379. <li>
  1380. <a id="fdlim" name="fdlim"><strong>Why can't I run more
  1381. than &lt;<em>n</em>&gt; virtual hosts?</strong></a>
  1382. <p>You are probably running into resource limitations in
  1383. your operating system. The most common limitation is the
  1384. <em>per</em>-process limit on <strong>file
  1385. descriptors</strong>, which is almost always the cause of
  1386. problems seen when adding virtual hosts. Apache often does
  1387. not give an intuitive error message because it is normally
  1388. some library routine (such as <code>gethostbyname()</code>)
  1389. which needs file descriptors and doesn't complain
  1390. intelligibly when it can't get them.</p>
  1391. <p>Each log file requires a file descriptor, which means
  1392. that if you are using separate access and error logs for
  1393. each virtual host, each virtual host needs two file
  1394. descriptors. Each <a
  1395. href="../mod/core.html#listen"><samp>Listen</samp></a>
  1396. directive also needs a file descriptor.</p>
  1397. <p>Typical values for &lt;<em>n</em>&gt; that we've seen
  1398. are in the neighborhood of 128 or 250. When the server
  1399. bumps into the file descriptor limit, it may dump core with
  1400. a SIGSEGV, it might just hang, or it may limp along and
  1401. you'll see (possibly meaningful) errors in the error log.
  1402. One common problem that occurs when you run into a file
  1403. descriptor limit is that CGI scripts stop being executed
  1404. properly.</p>
  1405. <p>As to what you can do about this:</p>
  1406. <ol>
  1407. <li>Reduce the number of <a
  1408. href="../mod/core.html#listen"><samp>Listen</samp></a>
  1409. directives. If there are no other servers running on the
  1410. machine on the same port then you normally don't need any
  1411. Listen directives at all. By default Apache listens to
  1412. all addresses on port 80.</li>
  1413. <li>Reduce the number of log files. You can use <a
  1414. href="../mod/mod_log_config.html"><samp>mod_log_config</samp></a>
  1415. to log all requests to a single log file while including
  1416. the name of the virtual host in the log file. You can
  1417. then write a script to split the logfile into separate
  1418. files later if necessary. Such a script is provided with
  1419. the Apache 1.3 distribution in the
  1420. <samp>src/support/split-logfile</samp> file.</li>
  1421. <li>
  1422. Increase the number of file descriptors available to
  1423. the server (see your system's documentation on the
  1424. <code>limit</code> or <code>ulimit</code> commands).
  1425. For some systems, information on how to do this is
  1426. available in the <a href="perf.html">performance
  1427. hints</a> page. There is a specific note for <a
  1428. href="#freebsd-setsize">FreeBSD</a> below.
  1429. <p>For Windows 95, try modifying your
  1430. <samp>C:\CONFIG.SYS</samp> file to include a line
  1431. like</p>
  1432. <dl>
  1433. <dd><code>FILES=300</code></dd>
  1434. </dl>
  1435. <p>Remember that you'll need to reboot your Windows 95
  1436. system in order for the new value to take effect.</p>
  1437. </li>
  1438. <li>"Don't do that" - try to run with fewer virtual
  1439. hosts</li>
  1440. <li>Spread your operation across multiple server
  1441. processes (using <a
  1442. href="../mod/core.html#listen"><samp>Listen</samp></a>
  1443. for example, but see the first point) and/or ports.</li>
  1444. </ol>
  1445. <p>Since this is an operating-system limitation, there's
  1446. not much else available in the way of solutions.</p>
  1447. <p>As of 1.2.1 we have made attempts to work around various
  1448. limitations involving running with many descriptors. <a
  1449. href="descriptors.html">More information is
  1450. available.</a></p>
  1451. <hr />
  1452. </li>
  1453. <li>
  1454. <a id="freebsd-setsize" name="freebsd-setsize"><strong>Can
  1455. I increase <samp>FD_SETSIZE</samp> on FreeBSD?</strong></a>
  1456. <p>On versions of FreeBSD before 3.0, the
  1457. <samp>FD_SETSIZE</samp> define defaults to 256. This means
  1458. that you will have trouble usefully using more than 256
  1459. file descriptors in Apache. This can be increased, but
  1460. doing so can be tricky.</p>
  1461. <p>If you are using a version prior to 2.2, you need to
  1462. recompile your kernel with a larger
  1463. <samp>FD_SETSIZE</samp>. This can be done by adding a line
  1464. such as:</p>
  1465. <dl>
  1466. <dd><code>options FD_SETSIZE <em>nnn</em></code></dd>
  1467. </dl>
  1468. <p>to your kernel config file. Starting at version 2.2,
  1469. this is no longer necessary.</p>
  1470. <p>If you are using a version of 2.1-stable from after
  1471. 1997/03/10 or 2.2 or 3.0-current from before 1997/06/28,
  1472. there is a limit in the resolver library that prevents it
  1473. from using more file descriptors than what
  1474. <samp>FD_SETSIZE</samp> is set to when libc is compiled. To
  1475. increase this, you have to recompile libc with a higher
  1476. <samp>FD_SETSIZE</samp>.</p>
  1477. <p>In FreeBSD 3.0, the default <samp>FD_SETSIZE</samp> has
  1478. been increased to 1024 and the above limitation in the
  1479. resolver library has been removed.</p>
  1480. <p>After you deal with the appropriate changes above, you
  1481. can increase the setting of <samp>FD_SETSIZE</samp> at
  1482. Apache compilation time by adding
  1483. "<samp>-DFD_SETSIZE=<em>nnn</em></samp>" to the
  1484. <samp>EXTRA_CFLAGS</samp> line in your
  1485. <samp>Configuration</samp> file.</p>
  1486. <hr />
  1487. </li>
  1488. <li>
  1489. <a id="errordoc401" name="errordoc401"><strong>Why doesn't
  1490. my <code>ErrorDocument 401</code> work?</strong></a>
  1491. <p>You need to use it with a URL in the form
  1492. "<samp>/foo/bar</samp>" and not one with a method and
  1493. hostname such as "<samp>http://host/foo/bar</samp>". See
  1494. the <a
  1495. href="../mod/core.html#errordocument"><samp>ErrorDocument</samp></a>
  1496. documentation for details. This was incorrectly documented
  1497. in the past.</p>
  1498. <hr />
  1499. </li>
  1500. <li>
  1501. <a id="cookies1" name="cookies1"><strong>Why does Apache
  1502. send a cookie on every response?</strong></a>
  1503. <p>Apache does <em>not</em> automatically send a cookie on
  1504. every response, unless you have re-compiled it with the <a
  1505. href="../mod/mod_usertrack.html"><samp>mod_usertrack</samp></a>
  1506. module, and specifically enabled it with the <a
  1507. href="../mod/mod_usertrack.html#cookietracking"><samp>CookieTracking</samp></a>
  1508. directive. This module has been in Apache since version
  1509. 1.2. This module may help track users, and uses cookies to
  1510. do this. If you are not using the data generated by
  1511. <samp>mod_usertrack</samp>, do not compile it into
  1512. Apache.</p>
  1513. <hr />
  1514. </li>
  1515. <li>
  1516. <a id="cookies2" name="cookies2"><strong>Why don't my
  1517. cookies work, I even compiled in
  1518. <samp>mod_cookies</samp>?</strong></a>
  1519. <p>Firstly, you do <em>not</em> need to compile in
  1520. <samp>mod_cookies</samp> in order for your scripts to work
  1521. (see the <a href="#cookies1">previous question</a> for more
  1522. about <samp>mod_cookies</samp>). Apache passes on your
  1523. <samp>Set-Cookie</samp> header fine, with or without this
  1524. module. If cookies do not work it will be because your
  1525. script does not work properly or your browser does not use
  1526. cookies or is not set-up to accept them.</p>
  1527. <hr />
  1528. </li>
  1529. <li>
  1530. <a id="jdk1-and-http1.1"
  1531. name="jdk1-and-http1.1"><strong>Why do my Java app[let]s
  1532. give me plain text when I request an URL from an Apache
  1533. server?</strong></a>
  1534. <p>As of version 1.2, Apache is an HTTP/1.1 (HyperText
  1535. Transfer Protocol version 1.1) server. This fact is
  1536. reflected in the protocol version that's included in the
  1537. response headers sent to a client when processing a
  1538. request. Unfortunately, low-level Web access classes
  1539. included in the Java Development Kit (JDK) version 1.0.2
  1540. expect to see the version string "HTTP/1.0" and do not
  1541. correctly interpret the "HTTP/1.1" value Apache is sending
  1542. (this part of the response is a declaration of what the
  1543. server can do rather than a declaration of the dialect of
  1544. the response). The result is that the JDK methods do not
  1545. correctly parse the headers, and include them with the
  1546. document content by mistake.</p>
  1547. <p>This is definitely a bug in the JDK 1.0.2 foundation
  1548. classes from Sun, and it has been fixed in version 1.1.
  1549. However, the classes in question are part of the virtual
  1550. machine environment, which means they're part of the Web
  1551. browser (if Java-enabled) or the Java environment on the
  1552. client system - so even if you develop <em>your</em>
  1553. classes with a recent JDK, the eventual users might
  1554. encounter the problem. The classes involved are replaceable
  1555. by vendors implementing the Java virtual machine
  1556. environment, and so even those that are based upon the
  1557. 1.0.2 version may not have this problem.</p>
  1558. <p>In the meantime, a workaround is to tell Apache to
  1559. "fake" an HTTP/1.0 response to requests that come from the
  1560. JDK methods; this can be done by including a line such as
  1561. the following in your server configuration files:</p>
  1562. <dl>
  1563. <dd><code>BrowserMatch Java1.0 force-response-1.0<br />
  1564. BrowserMatch JDK/1.0 force-response-1.0</code></dd>
  1565. </dl>
  1566. <p>More information about this issue can be found in the <a
  1567. href="http://httpd.apache.org/info/jdk-102.html"><cite>Java
  1568. and HTTP/1.1</cite></a> page at the Apache web site.</p>
  1569. <hr />
  1570. </li>
  1571. <li>
  1572. <a id="midi" name="midi"><strong>How do I get Apache to
  1573. send a MIDI file so the browser can play it?</strong></a>
  1574. <p>Even though the registered MIME type for MIDI files is
  1575. <samp>audio/midi</samp>, some browsers are not set up to
  1576. recognize it as such; instead, they look for
  1577. <samp>audio/x-midi</samp>. There are two things you can do
  1578. to address this:</p>
  1579. <ol>
  1580. <li>Configure your browser to treat documents of type
  1581. <samp>audio/midi</samp> correctly. This is the type that
  1582. Apache sends by default. This may not be workable,
  1583. however, if you have many client installations to change,
  1584. or if some or many of the clients are not under your
  1585. control.</li>
  1586. <li>
  1587. Instruct Apache to send a different
  1588. <samp>Content-type</samp> header for these files by
  1589. adding the following line to your server's
  1590. configuration files:
  1591. <dl>
  1592. <dd><code>AddType audio/x-midi .mid .midi
  1593. .kar</code></dd>
  1594. </dl>
  1595. <p>Note that this may break browsers that <em>do</em>
  1596. recognize the <samp>audio/midi</samp> MIME type unless
  1597. they're prepared to also handle
  1598. <samp>audio/x-midi</samp> the same way.</p>
  1599. </li>
  1600. </ol>
  1601. <hr />
  1602. </li>
  1603. <li>
  1604. <a id="addlog" name="addlog"><strong>How do I add browsers
  1605. and referrers to my logs?</strong></a>
  1606. <p>Apache provides a couple of different ways of doing
  1607. this. The recommended method is to compile the <a
  1608. href="../mod/mod_log_config.html"><samp>mod_log_config</samp></a>
  1609. module into your configuration and use the <a
  1610. href="../mod/mod_log_config.html#customlog"><samp>CustomLog</samp></a>
  1611. directive.</p>
  1612. <p>You can either log the additional information in files
  1613. other than your normal transfer log, or you can add them to
  1614. the records already being written. For example:</p>
  1615. <p>
  1616. <code>CustomLog&nbsp;logs/access_log&nbsp;"%h&nbsp;%l&nbsp;%u&nbsp;%t&nbsp;\"%r\"&nbsp;%s&nbsp;%b&nbsp;\"%{Referer}i\"&nbsp;\"%{User-Agent}i\""</code></p>
  1617. <p>This will add the values of the <samp>User-agent:</samp>
  1618. and <samp>Referer:</samp> headers, which indicate the
  1619. client and the referring page, respectively, to the end of
  1620. each line in the access log.</p>
  1621. <p>You may want to check out the <cite>Apache Week</cite>
  1622. article entitled: "<a
  1623. href="http://www.apacheweek.com/features/logfiles"
  1624. rel="Help"><cite>Gathering Visitor Information: Customizing
  1625. Your Logfiles</cite></a>".</p>
  1626. <hr />
  1627. </li>
  1628. <li>
  1629. <a id="set-servername" name="set-servername"><strong>Why
  1630. does accessing directories only work when I include the
  1631. trailing "/"
  1632. (<em>e.g.</em>,&nbsp;<samp>http://foo.domain.com/~user/</samp>)
  1633. but not when I omit it
  1634. (<em>e.g.</em>,&nbsp;<samp>http://foo.domain.com/~user</samp>)?</strong></a>
  1635. <p>When you access a directory without a trailing "/",
  1636. Apache needs to send what is called a redirect to the
  1637. client to tell it to add the trailing slash. If it did not
  1638. do so, relative URLs would not work properly. When it sends
  1639. the redirect, it needs to know the name of the server so
  1640. that it can include it in the redirect. There are two ways
  1641. for Apache to find this out; either it can guess, or you
  1642. can tell it. If your DNS is configured correctly, it can
  1643. normally guess without any problems. If it is not, however,
  1644. then you need to tell it.</p>
  1645. <p>Add a <a
  1646. href="../mod/core.html#servername">ServerName</a> directive
  1647. to the config file to tell it what the domain name of the
  1648. server is.</p>
  1649. <hr />
  1650. </li>
  1651. <li>
  1652. <a id="no-info-directives"
  1653. name="no-info-directives"><strong>Why doesn't mod_info list
  1654. any directives?</strong></a>
  1655. <p>The <a
  1656. href="../mod/mod_info.html"><samp>mod_info</samp></a>
  1657. module allows you to use a Web browser to see how your
  1658. server is configured. Among the information it displays is
  1659. the list modules and their configuration directives. The
  1660. "current" values for the directives are not necessarily
  1661. those of the running server; they are extracted from the
  1662. configuration files themselves at the time of the request.
  1663. If the files have been changed since the server was last
  1664. reloaded, the display will not match the values actively in
  1665. use. If the files and the path to the files are not
  1666. readable by the user as which the server is running (see
  1667. the <a href="../mod/core.html#user"><samp>User</samp></a>
  1668. directive), then <samp>mod_info</samp> cannot read them in
  1669. order to list their values. An entry <em>will</em> be made
  1670. in the error log in this event, however.</p>
  1671. <hr />
  1672. </li>
  1673. <li>
  1674. <a id="namevhost" name="namevhost"><strong>I upgraded to
  1675. Apache 1.3 and now my virtual hosts don't
  1676. work!</strong></a>
  1677. <p>In versions of Apache prior to 1.3b2, there was a lot of
  1678. confusion regarding address-based virtual hosts and
  1679. (HTTP/1.1) name-based virtual hosts, and the rules
  1680. concerning how the server processed
  1681. <samp>&lt;VirtualHost&gt;</samp> definitions were very
  1682. complex and not well documented.</p>
  1683. <p>Apache 1.3b2 introduced a new directive, <a
  1684. href="../mod/core.html#namevirtualhost"><samp>NameVirtualHost</samp></a>,
  1685. which simplifies the rules quite a bit. However, changing
  1686. the rules like this means that your existing name-based
  1687. <samp>&lt;VirtualHost&gt;</samp> containers probably won't
  1688. work correctly immediately following the upgrade.</p>
  1689. <p>To correct this problem, add the following line to the
  1690. beginning of your server configuration file, before
  1691. defining any virtual hosts:</p>
  1692. <dl>
  1693. <dd><code>NameVirtualHost <em>n.n.n.n</em></code></dd>
  1694. </dl>
  1695. <p>Replace the "<samp>n.n.n.n</samp>" with the IP address
  1696. to which the name-based virtual host names resolve; if you
  1697. have multiple name-based hosts on multiple addresses,
  1698. repeat the directive for each address.</p>
  1699. <p>Make sure that your name-based
  1700. <samp>&lt;VirtualHost&gt;</samp> blocks contain
  1701. <samp>ServerName</samp> and possibly
  1702. <samp>ServerAlias</samp> directives so Apache can be sure
  1703. to tell them apart correctly.</p>
  1704. <p>Please see the <a href="../vhosts/">Apache Virtual Host
  1705. documentation</a> for further details about
  1706. configuration.</p>
  1707. <hr />
  1708. </li>
  1709. <li>
  1710. <a id="redhat-htm" name="redhat-htm"><strong>I'm using
  1711. RedHat Linux and my .htm files are showing up as HTML
  1712. source rather than being formatted!</strong></a>
  1713. <p>RedHat messed up and forgot to put a content type for
  1714. <code>.htm</code> files into <code>/etc/mime.types</code>.
  1715. Edit <code>/etc/mime.types</code>, find the line containing
  1716. <code>html</code> and add <code>htm</code> to it. Then
  1717. restart your httpd server:</p>
  1718. <dl>
  1719. <dd><code>kill -HUP `cat /var/run/httpd.pid`</code></dd>
  1720. </dl>
  1721. <p>Then <strong>clear your browsers' caches</strong>. (Many
  1722. browsers won't re-examine the content type after they've
  1723. reloaded a page.)</p>
  1724. <hr />
  1725. </li>
  1726. <li>
  1727. <a id="htaccess-work" name="htaccess-work"><strong>My
  1728. <code>.htaccess</code> files are being
  1729. ignored.</strong></a>
  1730. <p>This is almost always due to your <a
  1731. href="../mod/core.html#allowoverride">AllowOverride</a>
  1732. directive being set incorrectly for the directory in
  1733. question. If it is set to <code>None</code> then .htaccess
  1734. files will not even be looked for. If you do have one that
  1735. is set, then be certain it covers the directory you are
  1736. trying to use the .htaccess file in. This is normally
  1737. accomplished by ensuring it is inside the proper <a
  1738. href="../mod/core.html#directory">Directory</a>
  1739. container.</p>
  1740. <hr />
  1741. </li>
  1742. <li>
  1743. <a id="forbidden" name="forbidden"><strong>Why do I get a
  1744. "<samp>Forbidden</samp>" message whenever I try to access a
  1745. particular directory?</strong></a>
  1746. <p>This message is generally caused because either</p>
  1747. <ul>
  1748. <li>The underlying file system permissions do not allow
  1749. the User/Group under which Apache is running to access
  1750. the necessary files; or</li>
  1751. <li>The Apache configuration has some access restrictions
  1752. in place which forbid access to the files.</li>
  1753. </ul>
  1754. <p>You can determine which case applies to your situation
  1755. by checking the error log.</p>
  1756. <p>In the case where file system permission are at fault,
  1757. remember that not only must the directory and files in
  1758. question be readable, but also all parent directories must
  1759. be at least searchable by the web server in order for the
  1760. content to be accessible.</p>
  1761. <hr />
  1762. </li>
  1763. <li>
  1764. <a id="malfiles" name="malfiles"><b>Why do I get a
  1765. "<samp>Forbidden/You don't have permission to access / on
  1766. this server</samp>" message whenever I try to access my
  1767. server?</b></a>
  1768. <p>Search your <code>conf/httpd.conf</code> file for this
  1769. exact string: <code>&lt;Files ~&gt;</code>. If you find it,
  1770. that's your problem -- that particular &lt;Files&gt;
  1771. container is malformed. Delete it or replace it with
  1772. <code>&lt;Files ~ "^\.ht"&gt;</code> and restart your
  1773. server and things should work as expected.</p>
  1774. <p>This error appears to be caused by a problem with the
  1775. version of linuxconf distributed with Redhat 6.x. It may
  1776. reappear if you use linuxconf again.</p>
  1777. <p>If you don't find this string, check out the <a
  1778. href="#forbidden">previous question</a>.</p>
  1779. <hr />
  1780. </li>
  1781. <li>
  1782. <a id="ie-ignores-mime" name="ie-ignores-mime"><strong>Why
  1783. do my files appear correctly in Internet Explorer, but show
  1784. up as source or trigger a save window with
  1785. Netscape?</strong></a>
  1786. <p>Internet Explorer (IE) and Netscape handle mime type
  1787. detection in different ways, and therefore will display the
  1788. document differently. In particular, IE sometimes relies on
  1789. the file extension to determine the mime type. This can
  1790. happen when the server specifies a mime type of
  1791. <code>application/octet-stream</code> or
  1792. <code>text/plain</code>. (Unfortunately, this behavior
  1793. makes it impossible to properly send plain text in some
  1794. situations unless the file extension is <code>txt</code>.)
  1795. There are more details available on IE's mime type
  1796. detection behavior in an <a
  1797. href="http://msdn.microsoft.com/workshop/networking/moniker/overview/appendix_a.asp">
  1798. MSDN article</a>.</p>
  1799. <p>In order to make all browsers work correctly, you should
  1800. assure that Apache sends the correct mime type for the
  1801. file. This is accomplished by editing the
  1802. <code>mime.types</code> file or using an <a
  1803. href="../mod/mod_mime.html#addtype"><code>AddType</code></a>
  1804. directive in the Apache configuration files.</p>
  1805. <hr />
  1806. </li>
  1807. <li>
  1808. <a name="canonical-hostnames"><strong>My site is accessible
  1809. under many different hostnames; how do I redirect clients
  1810. so that they see only a single name?</strong></a>
  1811. <p>Many sites map a variety of hostnames to the same content.
  1812. For example, <code>www.example.com</code>,
  1813. <code>example.com</code> and <code>www.example.net</code> may
  1814. all refer to the same site. It is best to make sure that,
  1815. regardless of the name clients use to access the site, they
  1816. will be redirected to a single, canonical hostname. This
  1817. makes the site easier to maintain and assures that there will
  1818. be only one version of the site in proxy caches and search
  1819. engines.</p>
  1820. <p>There are two techniques to implement canonical hostnames:</p>
  1821. <ol>
  1822. <li>Use <a href="../mod/mod_rewrite.html">mod_rewrite</a>
  1823. as described in the "Canonical Hostnames" section of the
  1824. <a href="rewriteguide.html">URL Rewriting Guide</a>.</li>
  1825. <li>Use <a href="../vhosts/name-based.html">name-based
  1826. virtual hosting</a>:
  1827. <blockquote><code>
  1828. NameVirtualHost *<br />
  1829. <br />
  1830. &lt;VirtualHost *&gt;<br />
  1831. &nbsp;&nbsp;ServerName www.example.net<br />
  1832. &nbsp;&nbsp;ServerAlias example.com<br />
  1833. &nbsp;&nbsp;Redirect permanent / http://www.example.com/<br />
  1834. &lt;/VirtualHost&gt;<br />
  1835. <br />
  1836. &lt;VirtualHost *&gt;<br />
  1837. &nbsp;&nbsp;ServerName www.example.com<br />
  1838. &nbsp;&nbsp;DocumentRoot /usr/local/apache/htdocs<br />
  1839. &lt;/VirtualHost&gt;
  1840. </code></blockquote>
  1841. </li></ol>
  1842. <hr /></li>
  1843. <li><a id="firewall" name="firewall"><strong>Why can I access my
  1844. website from the server or from my local network, but I
  1845. can't access it from elsewhere on the Internet?</strong></a>
  1846. <p>There are many possible reasons for this, and almost all
  1847. of them are related to the configuration of your network, not
  1848. the configuration of the Apache HTTP Server. One of the most
  1849. common problems is that a firewall blocks access to the
  1850. default HTTP port 80. In particular, many consumer ISPs
  1851. block access to this port. You can see if this is the case
  1852. by changing any <code>Port</code> and <code>Listen</code>
  1853. directives in <code>httpd.conf</code> to use port 8000 and
  1854. then request your site using
  1855. <code>http://yourhost.example.com:8000/</code>. (Of course,
  1856. a very restrictive firewall may block this port as well.)</p>
  1857. <hr /></li>
  1858. </ol>
  1859. </body>
  1860. </html>
  1861. <h3>F. Dynamic Content (CGI and SSI)</h3>
  1862. <ol>
  1863. <li>
  1864. <a id="CGIoutsideScriptAlias"
  1865. name="CGIoutsideScriptAlias"><strong>How do I enable CGI
  1866. execution in directories other than the
  1867. ScriptAlias?</strong></a>
  1868. <p>Apache recognizes all files in a directory named as a <a
  1869. href="../mod/mod_alias.html#scriptalias"><samp>ScriptAlias</samp></a>
  1870. as being eligible for execution rather than processing as
  1871. normal documents. This applies regardless of the file name,
  1872. so scripts in a ScriptAlias directory don't need to be
  1873. named "<samp>*.cgi</samp>" or "<samp>*.pl</samp>" or
  1874. whatever. In other words, <em>all</em> files in a
  1875. ScriptAlias directory are scripts, as far as Apache is
  1876. concerned.</p>
  1877. <p>To persuade Apache to execute scripts in other
  1878. locations, such as in directories where normal documents
  1879. may also live, you must tell it how to recognize them - and
  1880. also that it's okay to execute them. For this, you need to
  1881. use something like the <a
  1882. href="../mod/mod_mime.html#addhandler"><samp>AddHandler</samp></a>
  1883. directive.</p>
  1884. <ol>
  1885. <li>
  1886. In an appropriate section of your server configuration
  1887. files, add a line such as
  1888. <dl>
  1889. <dd><code>AddHandler cgi-script .cgi</code></dd>
  1890. </dl>
  1891. <p>The server will then recognize that all files in
  1892. that location (and its logical descendants) that end in
  1893. "<samp>.cgi</samp>" are script files, not
  1894. documents.</p>
  1895. </li>
  1896. <li>Make sure that the directory location is covered by
  1897. an <a
  1898. href="../mod/core.html#options"><samp>Options</samp></a>
  1899. declaration that includes the <samp>ExecCGI</samp>
  1900. option.</li>
  1901. </ol>
  1902. <p>In some situations, you might not want to actually allow
  1903. all files named "<samp>*.cgi</samp>" to be executable.
  1904. Perhaps all you want is to enable a particular file in a
  1905. normal directory to be executable. This can be
  1906. alternatively accomplished <em>via</em> <a
  1907. href="../mod/mod_rewrite.html"><samp>mod_rewrite</samp></a>
  1908. and the following steps:</p>
  1909. <ol>
  1910. <li>
  1911. Locally add to the corresponding <samp>.htaccess</samp>
  1912. file a ruleset similar to this one:
  1913. <dl>
  1914. <dd><code>RewriteEngine on<br />
  1915. RewriteBase /~foo/bar/<br />
  1916. RewriteRule ^quux\.cgi$ -
  1917. [T=application/x-httpd-cgi]</code></dd>
  1918. </dl>
  1919. </li>
  1920. <li>Make sure that the directory location is covered by
  1921. an <a
  1922. href="../mod/core.html#options"><samp>Options</samp></a>
  1923. declaration that includes the <samp>ExecCGI</samp> and
  1924. <samp>FollowSymLinks</samp> option.</li>
  1925. </ol>
  1926. <hr />
  1927. </li>
  1928. <li>
  1929. <a id="premature-script-headers"
  1930. name="premature-script-headers"><strong>What does it mean
  1931. when my CGIs fail with "<samp>Premature end of script
  1932. headers</samp>"?</strong></a>
  1933. <p>It means just what it says: the server was expecting a
  1934. complete set of HTTP headers (one or more followed by a
  1935. blank line), and didn't get them.</p>
  1936. <p>The most common cause of this problem is the script
  1937. dying before sending the complete set of headers, or
  1938. possibly any at all, to the server. To see if this is the
  1939. case, try running the script standalone from an interactive
  1940. session, rather than as a script under the server. If you
  1941. get error messages, this is almost certainly the cause of
  1942. the "premature end of script headers" message. Even if the
  1943. CGI runs fine from the command line, remember that the
  1944. environment and permissions may be different when running
  1945. under the web server. The CGI can only access resources
  1946. allowed for the <a
  1947. href="../mod/core.html#user"><code>User</code></a> and <a
  1948. href="../mod/core.html#group"><code>Group</code></a>
  1949. specified in your Apache configuration. In addition, the
  1950. environment will not be the same as the one provided on the
  1951. command line, but it can be adjusted using the directives
  1952. provided by <a href="../mod/mod_env.html">mod_env</a>.</p>
  1953. <p>The second most common cause of this (aside from people
  1954. not outputting the required headers at all) is a result of
  1955. an interaction with Perl's output buffering. To make Perl
  1956. flush its buffers after each output statement, insert the
  1957. following statements around the <code>print</code> or
  1958. <code>write</code> statements that send your HTTP
  1959. headers:</p>
  1960. <dl>
  1961. <dd><code>{<br />
  1962. &nbsp;local ($oldbar) = $|;<br />
  1963. &nbsp;$cfh = select (STDOUT);<br />
  1964. &nbsp;$| = 1;<br />
  1965. &nbsp;#<br />
  1966. &nbsp;# print your HTTP headers here<br />
  1967. &nbsp;#<br />
  1968. &nbsp;$| = $oldbar;<br />
  1969. &nbsp;select ($cfh);<br />
  1970. }</code></dd>
  1971. </dl>
  1972. <p>This is generally only necessary when you are calling
  1973. external programs from your script that send output to
  1974. stdout, or if there will be a long delay between the time
  1975. the headers are sent and the actual content starts being
  1976. emitted. To maximize performance, you should turn
  1977. buffer-flushing back <em>off</em> (with <code>$| = 0</code>
  1978. or the equivalent) after the statements that send the
  1979. headers, as displayed above.</p>
  1980. <p>If your script isn't written in Perl, do the equivalent
  1981. thing for whatever language you <em>are</em> using
  1982. (<em>e.g.</em>, for C, call <code>fflush()</code> after
  1983. writing the headers).</p>
  1984. <p>Another cause for the "premature end of script headers"
  1985. message are the RLimitCPU and RLimitMEM directives. You may
  1986. get the message if the CGI script was killed due to a
  1987. resource limit.</p>
  1988. <p>In addition, a configuration problem in <a
  1989. href="../suexec.html">suEXEC</a>, mod_perl, or another
  1990. third party module can often interfere with the execution
  1991. of your CGI and cause the "premature end of script headers"
  1992. message.</p>
  1993. <hr />
  1994. </li>
  1995. <li>
  1996. <a id="POSTnotallowed" name="POSTnotallowed"><strong>Why do
  1997. I keep getting "Method Not Allowed" for form POST
  1998. requests?</strong></a>
  1999. <p>This is almost always due to Apache not being configured
  2000. to treat the file you are trying to POST to as a CGI
  2001. script. You can not POST to a normal HTML file; the
  2002. operation has no meaning. See the FAQ entry on <a
  2003. href="#CGIoutsideScriptAlias">CGIs outside ScriptAliased
  2004. directories</a> for details on how to configure Apache to
  2005. treat the file in question as a CGI.</p>
  2006. <hr />
  2007. </li>
  2008. <li>
  2009. <a id="nph-scripts" name="nph-scripts"><strong>How can I
  2010. get my script's output without Apache buffering it? Why
  2011. doesn't my server push work?</strong></a>
  2012. <p>As of Apache 1.3, CGI scripts are essentially not
  2013. buffered. Every time your script does a "flush" to output
  2014. data, that data gets relayed on to the client. Some
  2015. scripting languages, for example Perl, have their own
  2016. buffering for output - this can be disabled by setting the
  2017. <code>$|</code> special variable to 1. Of course this does
  2018. increase the overall number of packets being transmitted,
  2019. which can result in a sense of slowness for the end
  2020. user.</p>
  2021. <p>Prior to 1.3, you needed to use "nph-" scripts to
  2022. accomplish non-buffering. Today, the only difference
  2023. between nph scripts and normal scripts is that nph scripts
  2024. require the full HTTP headers to be sent.</p>
  2025. <hr />
  2026. </li>
  2027. <li>
  2028. <a id="cgi-spec" name="cgi-spec"><strong>Where can I find
  2029. the "CGI specification"?</strong></a>
  2030. <p>The Common Gateway Interface (CGI) specification can be
  2031. found at the original NCSA site &lt; <a
  2032. href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html"><samp>
  2033. http://hoohoo.ncsa.uiuc.edu/cgi/interface.html</samp></a>&gt;.
  2034. This version hasn't been updated since 1995, and there have
  2035. been some efforts to update it.</p>
  2036. <p>A new draft is being worked on with the intent of making
  2037. it an informational RFC; you can find out more about this
  2038. project at &lt;<a
  2039. href="http://web.golux.com/coar/cgi/"><samp>http://web.golux.com/coar/cgi/</samp></a>&gt;.</p>
  2040. <hr />
  2041. </li>
  2042. <li>
  2043. <a id="fastcgi" name="fastcgi"><strong>Why isn't FastCGI
  2044. included with Apache any more?</strong></a>
  2045. <p>The simple answer is that it was becoming too difficult
  2046. to keep the version being included with Apache synchronized
  2047. with the master copy at the <a
  2048. href="http://www.fastcgi.com/">FastCGI web site</a>. When a
  2049. new version of Apache was released, the version of the
  2050. FastCGI module included with it would soon be out of
  2051. date.</p>
  2052. <p>You can still obtain the FastCGI module for Apache from
  2053. the master FastCGI web site.</p>
  2054. <hr />
  2055. </li>
  2056. <li>
  2057. <a id="ssi-part-i" name="ssi-part-i"><strong>How do I
  2058. enable SSI (parsed HTML)?</strong></a>
  2059. <p>SSI (an acronym for Server-Side Include) directives
  2060. allow static HTML documents to be enhanced at run-time
  2061. (<em>e.g.</em>, when delivered to a client by Apache). The
  2062. format of SSI directives is covered in the <a
  2063. href="../mod/mod_include.html">mod_include manual</a>;
  2064. suffice it to say that Apache supports not only SSI but
  2065. xSSI (eXtended SSI) directives.</p>
  2066. <p>Processing a document at run-time is called
  2067. <em>parsing</em> it; hence the term "parsed HTML" sometimes
  2068. used for documents that contain SSI instructions. Parsing
  2069. tends to be resource-consumptive compared to serving static
  2070. files, and is not enabled by default. It can also interfere
  2071. with the cachability of your documents, which can put a
  2072. further load on your server. (See the <a
  2073. href="#ssi-part-ii">next question</a> for more information
  2074. about this.)</p>
  2075. <p>To enable SSI processing, you need to</p>
  2076. <ul>
  2077. <li>Build your server with the <a
  2078. href="../mod/mod_include.html"><samp>mod_include</samp></a>
  2079. module. This is normally compiled in by default.</li>
  2080. <li>Make sure your server configuration files have an <a
  2081. href="../mod/core.html#options"><samp>Options</samp></a>
  2082. directive which permits <samp>Includes</samp>.</li>
  2083. <li>
  2084. Make sure that the directory where you want the SSI
  2085. documents to live is covered by the "server-parsed"
  2086. content handler, either explicitly or in some ancestral
  2087. location. That can be done with the following <a
  2088. href="../mod/mod_mime.html#addhandler"><samp>AddHandler</samp></a>
  2089. directive:
  2090. <dl>
  2091. <dd><code>AddHandler server-parsed .shtml</code></dd>
  2092. </dl>
  2093. <p>This indicates that all files ending in ".shtml" in
  2094. that location (or its descendants) should be parsed.
  2095. Note that using ".html" will cause all normal HTML
  2096. files to be parsed, which may put an inordinate load on
  2097. your server.</p>
  2098. </li>
  2099. </ul>
  2100. <p>For additional information, see the <cite>Apache
  2101. Week</cite> article on <a
  2102. href="http://www.apacheweek.com/features/ssi"
  2103. rel="Help"><cite>Using Server Side Includes</cite></a>.</p>
  2104. <hr />
  2105. </li>
  2106. <li>
  2107. <a id="ssi-part-ii" name="ssi-part-ii"><strong>Why don't my
  2108. parsed files get cached?</strong></a>
  2109. <p>Since the server is performing run-time processing of
  2110. your SSI directives, which may change the content shipped
  2111. to the client, it can't know at the time it starts parsing
  2112. what the final size of the result will be, or whether the
  2113. parsed result will always be the same. This means that it
  2114. can't generate <samp>Content-Length</samp> or
  2115. <samp>Last-Modified</samp> headers. Caches commonly work by
  2116. comparing the <samp>Last-Modified</samp> of what's in the
  2117. cache with that being delivered by the server. Since the
  2118. server isn't sending that header for a parsed document,
  2119. whatever's doing the caching can't tell whether the
  2120. document has changed or not - and so fetches it again to be
  2121. on the safe side.</p>
  2122. <p>You can work around this in some cases by causing an
  2123. <samp>Expires</samp> header to be generated. (See the <a
  2124. href="../mod/mod_expires.html"
  2125. rel="Help"><samp>mod_expires</samp></a> documentation for
  2126. more details.) Another possibility is to use the <a
  2127. href="../mod/mod_include.html#xbithack"
  2128. rel="Help"><samp>XBitHack Full</samp></a> mechanism, which
  2129. tells Apache to send (under certain circumstances detailed
  2130. in the XBitHack directive description) a
  2131. <samp>Last-Modified</samp> header based upon the last
  2132. modification time of the file being parsed. Note that this
  2133. may actually be lying to the client if the parsed file
  2134. doesn't change but the SSI-inserted content does; if the
  2135. included content changes often, this can result in stale
  2136. copies being cached.</p>
  2137. <hr />
  2138. </li>
  2139. <li>
  2140. <a id="ssi-part-iii" name="ssi-part-iii"><strong>How can I
  2141. have my script output parsed?</strong></a>
  2142. <p>So you want to include SSI directives in the output from
  2143. your CGI script, but can't figure out how to do it? The
  2144. short answer is "you can't." This is potentially a security
  2145. liability and, more importantly, it can not be cleanly
  2146. implemented under the current server API. The best
  2147. workaround is for your script itself to do what the SSIs
  2148. would be doing. After all, it's generating the rest of the
  2149. content.</p>
  2150. <p>This is a feature The Apache Group hopes to add in the
  2151. next major release after 1.3.</p>
  2152. <hr />
  2153. </li>
  2154. <li>
  2155. <a id="ssi-part-iv" name="ssi-part-iv"><strong>SSIs don't
  2156. work for VirtualHosts and/or user home
  2157. directories.</strong></a>
  2158. <p>This is almost always due to having some setting in your
  2159. config file that sets "Options Includes" or some other
  2160. setting for your DocumentRoot but not for other
  2161. directories. If you set it inside a Directory section, then
  2162. that setting will only apply to that directory.</p>
  2163. <hr />
  2164. </li>
  2165. <li>
  2166. <a id="errordocssi" name="errordocssi"><strong>How can I
  2167. use <code>ErrorDocument</code> and SSI to simplify
  2168. customized error messages?</strong></a>
  2169. <p>Have a look at <a href="custom_errordocs.html">this
  2170. document</a>. It shows in example form how you can a
  2171. combination of XSSI and negotiation to tailor a set of
  2172. <code>ErrorDocument</code>s to your personal taste, and
  2173. returning different internationalized error responses based
  2174. on the client's native language.</p>
  2175. <hr />
  2176. </li>
  2177. <li>
  2178. <a id="remote-user-var" name="remote-user-var"><strong>Why
  2179. is the environment variable <samp>REMOTE_USER</samp> not
  2180. set?</strong></a>
  2181. <p>This variable is set and thus available in SSI or CGI
  2182. scripts <strong>if and only if</strong> the requested
  2183. document was protected by access authentication. For an
  2184. explanation on how to implement these restrictions, see <a
  2185. href="http://www.apacheweek.com/"><cite>Apache
  2186. Week</cite></a>'s articles on <a
  2187. href="http://www.apacheweek.com/features/userauth"><cite>Using
  2188. User Authentication</cite></a> or <a
  2189. href="http://www.apacheweek.com/features/dbmauth"><cite>DBM
  2190. User Authentication</cite></a>.</p>
  2191. <p>Hint: When using a CGI script to receive the data of a
  2192. HTML <samp>FORM</samp> notice that protecting the document
  2193. containing the <samp>FORM</samp> is not sufficient to
  2194. provide <samp>REMOTE_USER</samp> to the CGI script. You
  2195. have to protect the CGI script, too. Or alternatively only
  2196. the CGI script (then authentication happens only after
  2197. filling out the form).</p>
  2198. <hr />
  2199. </li>
  2200. <li>
  2201. <a id="user-cgi" name="user-cgi"><strong>How do I allow
  2202. each of my user directories to have a cgi-bin
  2203. directory?</strong></a>
  2204. <p>Remember that CGI execution does not need to be
  2205. restricted only to cgi-bin directories. You can <a
  2206. href="#CGIoutsideScriptAlias">allow CGI script execution in
  2207. arbitrary parts of your filesystem</a>.</p>
  2208. <p>There are many ways to give each user directory a
  2209. cgi-bin directory such that anything requested as
  2210. <samp>http://example.com/~user/cgi-bin/program</samp> will
  2211. be executed as a CGI script. Two alternatives are:</p>
  2212. <ol>
  2213. <li>
  2214. Place the cgi-bin directory next to the public_html
  2215. directory:
  2216. <dl>
  2217. <dd><code>ScriptAliasMatch ^/~([^/]*)/cgi-bin/(.*)
  2218. /home/$1/cgi-bin/$2</code></dd>
  2219. </dl>
  2220. </li>
  2221. <li>
  2222. Place the cgi-bin directory underneath the public_html
  2223. directory:
  2224. <dl>
  2225. <dd><code>&lt;Directory
  2226. /home/*/public_html/cgi-bin&gt;<br />
  2227. &nbsp;&nbsp;&nbsp;&nbsp;Options ExecCGI<br />
  2228. &nbsp;&nbsp;&nbsp;&nbsp;SetHandler cgi-script<br />
  2229. &lt;/Directory&gt;</code></dd>
  2230. </dl>
  2231. </li>
  2232. </ol>
  2233. <hr />
  2234. </li>
  2235. </ol>
  2236. </body>
  2237. </html>
  2238. <h3>G. Authentication and Access Restrictions</h3>
  2239. <ol>
  2240. <li>
  2241. <a id="dnsauth" name="dnsauth"><strong>Why isn't
  2242. restricting access by host or domain name working
  2243. correctly?</strong></a>
  2244. <p>Two of the most common causes of this are:</p>
  2245. <ol>
  2246. <li><strong>An error, inconsistency, or unexpected
  2247. mapping in the DNS registration</strong><br />
  2248. This happens frequently: your configuration restricts
  2249. access to <samp>Host.FooBar.Com</samp>, but you can't get
  2250. in from that host. The usual reason for this is that
  2251. <samp>Host.FooBar.Com</samp> is actually an alias for
  2252. another name, and when Apache performs the
  2253. address-to-name lookup it's getting the <em>real</em>
  2254. name, not <samp>Host.FooBar.Com</samp>. You can verify
  2255. this by checking the reverse lookup yourself. The easiest
  2256. way to work around it is to specify the correct host name
  2257. in your configuration.</li>
  2258. <li>
  2259. <strong>Inadequate checking and verification in your
  2260. configuration of Apache</strong><br />
  2261. If you intend to perform access checking and
  2262. restriction based upon the client's host or domain
  2263. name, you really need to configure Apache to
  2264. double-check the origin information it's supplied. You
  2265. do this by adding the <samp>-DMAXIMUM_DNS</samp> clause
  2266. to the <samp>EXTRA_CFLAGS</samp> definition in your
  2267. <samp>Configuration</samp> file. For example:
  2268. <dl>
  2269. <dd><code>EXTRA_CFLAGS=-DMAXIMUM_DNS</code></dd>
  2270. </dl>
  2271. <p>This will cause Apache to be very paranoid about
  2272. making sure a particular host address is
  2273. <em>really</em> assigned to the name it claims to be.
  2274. Note that this <em>can</em> incur a significant
  2275. performance penalty, however, because of all the name
  2276. resolution requests being sent to a nameserver.</p>
  2277. </li>
  2278. </ol>
  2279. <hr />
  2280. </li>
  2281. <li>
  2282. <a id="user-authentication"
  2283. name="user-authentication"><strong>How do I set up Apache
  2284. to require a username and password to access certain
  2285. documents?</strong></a>
  2286. <p>There are several ways to do this; some of the more
  2287. popular ones are to use the <a
  2288. href="../mod/mod_auth.html">mod_auth</a>, <a
  2289. href="../mod/mod_auth_db.html">mod_auth_db</a>, or <a
  2290. href="../mod/mod_auth_dbm.html">mod_auth_dbm</a>
  2291. modules.</p>
  2292. <p>For an explanation on how to implement these
  2293. restrictions, see <a
  2294. href="http://www.apacheweek.com/"><cite>Apache
  2295. Week</cite></a>'s articles on <a
  2296. href="http://www.apacheweek.com/features/userauth"><cite>Using
  2297. User Authentication</cite></a> or <a
  2298. href="http://www.apacheweek.com/features/dbmauth"><cite>DBM
  2299. User Authentication</cite></a>.</p>
  2300. <hr />
  2301. </li>
  2302. <li>
  2303. <a id="remote-auth-only"
  2304. name="remote-auth-only"><strong>How do I set up Apache to
  2305. allow access to certain documents only if a site is either
  2306. a local site <em>or</em> the user supplies a password and
  2307. username?</strong></a>
  2308. <p>Use the <a href="../mod/core.html#satisfy">Satisfy</a>
  2309. directive, in particular the <code>Satisfy Any</code>
  2310. directive, to require that only one of the access
  2311. restrictions be met. For example, adding the following
  2312. configuration to a <samp>.htaccess</samp> or server
  2313. configuration file would restrict access to people who
  2314. either are accessing the site from a host under domain.com
  2315. or who can supply a valid username and password:</p>
  2316. <dl>
  2317. <dd><code>Deny from all<br />
  2318. Allow from .domain.com<br />
  2319. AuthType Basic<br />
  2320. AuthUserFile /usr/local/apache/conf/htpasswd.users<br />
  2321. AuthName "special directory"<br />
  2322. Require valid-user<br />
  2323. Satisfy any</code></dd>
  2324. </dl>
  2325. <p>See the <a href="#user-authentication">user
  2326. authentication</a> question and the <a
  2327. href="../mod/mod_access.html">mod_access</a> module for
  2328. details on how the above directives work.</p>
  2329. <hr />
  2330. </li>
  2331. <li>
  2332. <a id="authauthoritative"
  2333. name="authauthoritative"><strong>Why does my authentication
  2334. give me a server error?</strong></a>
  2335. <p>Under normal circumstances, the Apache access control
  2336. modules will pass unrecognized user IDs on to the next
  2337. access control module in line. Only if the user ID is
  2338. recognized and the password is validated (or not) will it
  2339. give the usual success or "authentication failed"
  2340. messages.</p>
  2341. <p>However, if the last access module in line 'declines'
  2342. the validation request (because it has never heard of the
  2343. user ID or because it is not configured), the
  2344. <samp>http_request</samp> handler will give one of the
  2345. following, confusing, errors:</p>
  2346. <ul>
  2347. <li><samp>check access</samp></li>
  2348. <li><samp>check user. No user file?</samp></li>
  2349. <li><samp>check access. No groups file?</samp></li>
  2350. </ul>
  2351. <p>This does <em>not</em> mean that you have to add an
  2352. '<samp>AuthUserFile&nbsp;/dev/null</samp>' line as some
  2353. magazines suggest!</p>
  2354. <p>The solution is to ensure that at least the last module
  2355. is authoritative and <strong>CONFIGURED</strong>. By
  2356. default, <samp>mod_auth</samp> is authoritative and will
  2357. give an OK/Denied, but only if it is configured with the
  2358. proper <samp>AuthUserFile</samp>. Likewise, if a valid
  2359. group is required. (Remember that the modules are processed
  2360. in the reverse order from that in which they appear in your
  2361. compile-time <samp>Configuration</samp> file.)</p>
  2362. <p>A typical situation for this error is when you are using
  2363. the <samp>mod_auth_dbm</samp>, <samp>mod_auth_msql</samp>,
  2364. <samp>mod_auth_mysql</samp>, <samp>mod_auth_anon</samp> or
  2365. <samp>mod_auth_cookie</samp> modules on their own. These
  2366. are by default <strong>not</strong> authoritative, and this
  2367. will pass the buck on to the (non-existent) next
  2368. authentication module when the user ID is not in their
  2369. respective database. Just add the appropriate
  2370. '<samp><em>XXX</em>Authoritative yes</samp>' line to the
  2371. configuration.</p>
  2372. <p>In general it is a good idea (though not terribly
  2373. efficient) to have the file-based <samp>mod_auth</samp> a
  2374. module of last resort. This allows you to access the web
  2375. server with a few special passwords even if the databases
  2376. are down or corrupted. This does cost a file
  2377. open/seek/close for each request in a protected area.</p>
  2378. <hr />
  2379. </li>
  2380. <li>
  2381. <a id="auth-on-same-machine"
  2382. name="auth-on-same-machine"><strong>Do I have to keep the
  2383. (mSQL) authentication information on the same
  2384. machine?</strong></a>
  2385. <p>Some organizations feel very strongly about keeping the
  2386. authentication information on a different machine than the
  2387. webserver. With the <samp>mod_auth_msql</samp>,
  2388. <samp>mod_auth_mysql</samp>, and other SQL modules
  2389. connecting to (R)DBMses this is quite possible. Just
  2390. configure an explicit host to contact.</p>
  2391. <p>Be aware that with mSQL and Oracle, opening and closing
  2392. these database connections is very expensive and time
  2393. consuming. You might want to look at the code in the
  2394. <samp>auth_*</samp> modules and play with the compile time
  2395. flags to alleviate this somewhat, if your RDBMS licences
  2396. allow for it.</p>
  2397. <hr />
  2398. </li>
  2399. <li>
  2400. <a id="msql-slow" name="msql-slow"><strong>Why is my mSQL
  2401. authentication terribly slow?</strong></a>
  2402. <p>You have probably configured the Host by specifying a
  2403. FQHN, and thus the <samp>libmsql</samp> will use a full
  2404. blown TCP/IP socket to talk to the database, rather than a
  2405. fast internal device. The <samp>libmsql</samp>, the mSQL
  2406. FAQ, and the <samp>mod_auth_msql</samp> documentation warn
  2407. you about this. If you have to use different hosts, check
  2408. out the <samp>mod_auth_msql</samp> code for some compile
  2409. time flags which might - or might not - suit you.</p>
  2410. <hr />
  2411. </li>
  2412. <li>
  2413. <a id="passwdauth" name="passwdauth"><strong>Can I use my
  2414. <samp>/etc/passwd</samp> file for Web page
  2415. authentication?</strong></a>
  2416. <p>Yes, you can - but it's a <strong>very bad
  2417. idea</strong>. Here are some of the reasons:</p>
  2418. <ul>
  2419. <li>The Web technology provides no governors on how often
  2420. or how rapidly password (authentication failure) retries
  2421. can be made. That means that someone can hammer away at
  2422. your system's <samp>root</samp> password using the Web,
  2423. using a dictionary or similar mass attack, just as fast
  2424. as the wire and your server can handle the requests. Most
  2425. operating systems these days include attack detection
  2426. (such as <em>n</em> failed passwords for the same account
  2427. within <em>m</em> seconds) and evasion (breaking the
  2428. connection, disabling the account under attack, disabling
  2429. <em>all</em> logins from that source, <em>et
  2430. cetera</em>), but the Web does not.</li>
  2431. <li>An account under attack isn't notified (unless the
  2432. server is heavily modified); there's no "You have 19483
  2433. login failures" message when the legitimate owner logs
  2434. in.</li>
  2435. <li>Without an exhaustive and error-prone examination of
  2436. the server logs, you can't tell whether an account has
  2437. been compromised. Detecting that an attack has occurred,
  2438. or is in progress, is fairly obvious, though -
  2439. <em>if</em> you look at the logs.</li>
  2440. <li>Web authentication passwords (at least for Basic
  2441. authentication) generally fly across the wire, and
  2442. through intermediate proxy systems, in what amounts to
  2443. plain text. "O'er the net we go/Caching all the way;/O
  2444. what fun it is to surf/Giving my password away!"</li>
  2445. <li>Since HTTP is stateless, information about the
  2446. authentication is transmitted <em>each and every
  2447. time</em> a request is made to the server. Essentially,
  2448. the client caches it after the first successful access,
  2449. and transmits it without asking for all subsequent
  2450. requests to the same server.</li>
  2451. <li>It's relatively trivial for someone on your system to
  2452. put up a page that will steal the cached password from a
  2453. client's cache without them knowing. Can you say
  2454. "password grabber"?</li>
  2455. </ul>
  2456. <p>If you still want to do this in light of the above
  2457. disadvantages, the method is left as an exercise for the
  2458. reader. It'll void your Apache warranty, though, and you'll
  2459. lose all accumulated UNIX guru points.</p>
  2460. <hr />
  2461. </li>
  2462. <li>
  2463. <a id="prompted-twice" name="prompted-twice"><strong>Why
  2464. does Apache ask for my password twice before serving a
  2465. file?</strong></a>
  2466. <p>If the hostname under which you are accessing the server
  2467. is different than the hostname specified in the <a
  2468. href="../mod/core.html#servername"><code>ServerName</code></a>
  2469. directive, then depending on the setting of the <a
  2470. href="../mod/core.html#usecanonicalname"><code>UseCanonicalName</code></a>
  2471. directive, Apache will redirect you to a new hostname when
  2472. constructing self-referential URLs. This happens, for
  2473. example, in the case where you request a directory without
  2474. including the trailing slash.</p>
  2475. <p>When this happens, Apache will ask for authentication
  2476. once under the original hostname, perform the redirect, and
  2477. then ask again under the new hostname. For security
  2478. reasons, the browser must prompt again for the password
  2479. when the host name changes.</p>
  2480. <p>To eliminate this problem you should</p>
  2481. <ol>
  2482. <li>Always use the trailing slash when requesting
  2483. directories;</li>
  2484. <li>Change the <code>ServerName</code> to match the name
  2485. you are using in the URL; and/or</li>
  2486. <li>Set <code>UseCanonicalName off</code>.</li>
  2487. </ol>
  2488. <hr />
  2489. </li>
  2490. </ol>
  2491. </body>
  2492. </html>
  2493. <h3>H. URL Rewriting</h3>
  2494. <ol>
  2495. <li>
  2496. <a id="rewrite-more-config"
  2497. name="rewrite-more-config"><strong>Where can I find
  2498. mod_rewrite rulesets which already solve particular
  2499. URL-related problems?</strong></a>
  2500. <p>There is a collection of <a
  2501. href="http://www.engelschall.com/pw/apache/rewriteguide/">Practical
  2502. Solutions for URL-Manipulation</a> where you can find all
  2503. typical solutions the author of <a
  2504. href="../mod/mod_rewrite.html"><samp>mod_rewrite</samp></a>
  2505. currently knows of. If you have more interesting rulesets
  2506. which solve particular problems not currently covered in
  2507. this document, send it to <a
  2508. href="mailto:rse@apache.org">Ralf S. Engelschall</a> for
  2509. inclusion. The other webmasters will thank you for avoiding
  2510. the reinvention of the wheel.</p>
  2511. <hr />
  2512. </li>
  2513. <li>
  2514. <a id="rewrite-article"
  2515. name="rewrite-article"><strong>Where can I find any
  2516. published information about URL-manipulations and
  2517. mod_rewrite?</strong></a>
  2518. <p>There is an article from <a
  2519. href="mailto:rse@apache.org">Ralf S. Engelschall</a> about
  2520. URL-manipulations based on <a
  2521. href="../mod/mod_rewrite.html"><samp>mod_rewrite</samp></a>
  2522. in the "iX Multiuser Multitasking Magazin" issue #12/96.
  2523. The german (original) version can be read online at &lt;<a
  2524. href="http://www.heise.de/ix/artikel/9612149/">http://www.heise.de/ix/artikel/9612149/</a>&gt;,
  2525. the English (translated) version can be found at &lt;<a
  2526. href="http://www.heise.de/ix/artikel/E/9612149/">http://www.heise.de/ix/artikel/E/9612149/</a>&gt;.</p>
  2527. <hr />
  2528. </li>
  2529. <li>
  2530. <a id="rewrite-complexity"
  2531. name="rewrite-complexity"><strong>Why is mod_rewrite so
  2532. difficult to learn and seems so complicated?</strong></a>
  2533. <p>Hmmm... there are a lot of reasons. First, mod_rewrite
  2534. itself is a powerful module which can help you in really
  2535. <strong>all</strong> aspects of URL rewriting, so it can be
  2536. no trivial module per definition. To accomplish its hard
  2537. job it uses software leverage and makes use of a powerful
  2538. regular expression library by Henry Spencer which is an
  2539. integral part of Apache since its version 1.2. And regular
  2540. expressions itself can be difficult to newbies, while
  2541. providing the most flexible power to the advanced
  2542. hacker.</p>
  2543. <p>On the other hand mod_rewrite has to work inside the
  2544. Apache API environment and needs to do some tricks to fit
  2545. there. For instance the Apache API as of 1.x really was not
  2546. designed for URL rewriting at the <tt>.htaccess</tt> level
  2547. of processing. Or the problem of multiple rewrites in
  2548. sequence, which is also not handled by the API per design.
  2549. To provide this features mod_rewrite has to do some special
  2550. (but API compliant!) handling which leads to difficult
  2551. processing inside the Apache kernel. While the user usually
  2552. doesn't see anything of this processing, it can be
  2553. difficult to find problems when some of your RewriteRules
  2554. seem not to work.</p>
  2555. <hr />
  2556. </li>
  2557. <li>
  2558. <a id="rewrite-dontwork"
  2559. name="rewrite-dontwork"><strong>What can I do if my
  2560. RewriteRules don't work as expected?</strong></a>
  2561. <p>Use "<samp>RewriteLog somefile</samp>" and
  2562. "<samp>RewriteLogLevel 9</samp>" and have a precise look at
  2563. the steps the rewriting engine performs. This is really the
  2564. only one and best way to debug your rewriting
  2565. configuration.</p>
  2566. <hr />
  2567. </li>
  2568. <li>
  2569. <a id="rewrite-prefixdocroot"
  2570. name="rewrite-prefixdocroot"><strong>Why don't some of my
  2571. URLs get prefixed with DocumentRoot when using
  2572. mod_rewrite?</strong></a>
  2573. <p>If the rule starts with <samp>/somedir/...</samp> make
  2574. sure that really no <samp>/somedir</samp> exists on the
  2575. filesystem if you don't want to lead the URL to match this
  2576. directory, <em>i.e.</em>, there must be no root directory
  2577. named <samp>somedir</samp> on the filesystem. Because if
  2578. there is such a directory, the URL will not get prefixed
  2579. with DocumentRoot. This behavior looks ugly, but is really
  2580. important for some other aspects of URL rewriting.</p>
  2581. <hr />
  2582. </li>
  2583. <li>
  2584. <a id="rewrite-nocase" name="rewrite-nocase"><strong>How
  2585. can I make all my URLs case-insensitive with
  2586. mod_rewrite?</strong></a>
  2587. <p>You can't! The reasons are: first, that, case
  2588. translations for arbitrary length URLs cannot be done
  2589. <em>via</em> regex patterns and corresponding
  2590. substitutions. One needs a per-character pattern like the
  2591. sed/Perl <samp>tr|..|..|</samp> feature. Second, just
  2592. making URLs always upper or lower case does not solve the
  2593. whole problem of case-INSENSITIVE URLs, because URLs
  2594. actually have to be rewritten to the correct case-variant
  2595. for the file residing on the filesystem in order to allow
  2596. Apache to access the file. And the Unix filesystem is
  2597. always case-SENSITIVE.</p>
  2598. <p>But there is a module named <code><a
  2599. href="../mod/mod_speling.html">mod_speling.c</a></code> in
  2600. the Apache distribution. Try this module to help correct
  2601. people who use mis-cased URLs.</p>
  2602. <hr />
  2603. </li>
  2604. <li>
  2605. <a id="rewrite-virthost"
  2606. name="rewrite-virthost"><strong>Why are RewriteRules in my
  2607. VirtualHost parts ignored?</strong></a>
  2608. <p>Because you have to enable the engine for every virtual
  2609. host explicitly due to security concerns. Just add a
  2610. "RewriteEngine on" to your virtual host configuration
  2611. parts.</p>
  2612. <hr />
  2613. </li>
  2614. <li>
  2615. <a id="rewrite-envwhitespace"
  2616. name="rewrite-envwhitespace"><strong>How can I use strings
  2617. with whitespaces in RewriteRule's ENV flag?</strong></a>
  2618. <p>There is only one ugly solution: You have to surround
  2619. the complete flag argument by quotation marks
  2620. (<samp>"[E=...]"</samp>). Notice: The argument to quote
  2621. here is not the argument to the E-flag, it is the argument
  2622. of the Apache config file parser, <em>i.e.</em>, the third
  2623. argument of the RewriteRule here. So you have to write
  2624. <samp>"[E=any text with whitespaces]"</samp>.</p>
  2625. <hr />
  2626. </li>
  2627. </ol>
  2628. </body>
  2629. </html>
  2630. <h3>I. Features</h3>
  2631. <ol>
  2632. <li>
  2633. <a id="proxy" name="proxy"><strong>Does or will Apache act
  2634. as a Proxy server?</strong></a>
  2635. <p>Apache version 1.1 and above comes with a <a
  2636. href="../mod/mod_proxy.html">proxy module</a>. If compiled
  2637. in, this will make Apache act as a caching-proxy
  2638. server.</p>
  2639. <hr />
  2640. </li>
  2641. <li>
  2642. <a id="multiviews" name="multiviews"><strong>What are
  2643. "multiviews"?</strong></a>
  2644. <p>"Multiviews" is the general name given to the Apache
  2645. server's ability to provide language-specific document
  2646. variants in response to a request. This is documented quite
  2647. thoroughly in the <a href="../content-negotiation.html"
  2648. rel="Help">content negotiation</a> description page. In
  2649. addition, <cite>Apache Week</cite> carried an article on
  2650. this subject entitled "<a
  2651. href="http://www.apacheweek.com/features/negotiation"
  2652. rel="Help"><cite>Content Negotiation
  2653. Explained</cite></a>".</p>
  2654. <hr />
  2655. </li>
  2656. <li>
  2657. <a id="putsupport" name="putsupport"><strong>Why can't I
  2658. publish to my Apache server using PUT on Netscape Gold and
  2659. other programs?</strong></a>
  2660. <p>Because you need to install and configure a script to
  2661. handle the uploaded files. This script is often called a
  2662. "PUT" handler. There are several available, but they may
  2663. have security problems. Using FTP uploads may be easier and
  2664. more secure, at least for now. For more information, see
  2665. the <cite>Apache Week</cite> article <a
  2666. href="http://www.apacheweek.com/features/put"><cite>Publishing
  2667. Pages with PUT</cite></a>.</p>
  2668. <hr />
  2669. </li>
  2670. <li>
  2671. <a id="SSL-i" name="SSL-i"><strong>Why doesn't Apache
  2672. include SSL?</strong></a>
  2673. <p>SSL (Secure Socket Layer) data transport requires
  2674. encryption, and many governments have restrictions upon the
  2675. import, export, and use of encryption technology. If Apache
  2676. included SSL in the base package, its distribution would
  2677. involve all sorts of legal and bureaucratic issues, and it
  2678. would no longer be freely available. Also, some of the
  2679. technology required to talk to current clients using SSL is
  2680. patented by <a href="http://www.rsa.com/">RSA Data
  2681. Security</a>, who restricts its use without a license.</p>
  2682. <p>Some SSL implementations of Apache are available,
  2683. however; see the "<a
  2684. href="http://httpd.apache.org/related_projects.html">related
  2685. projects</a>" page at the main Apache web site.</p>
  2686. <p>You can find out more about this topic in the
  2687. <cite>Apache Week</cite> article about <a
  2688. href="http://www.apacheweek.com/features/ssl"
  2689. rel="Help"><cite>Apache and Secure
  2690. Transactions</cite></a>.</p>
  2691. <hr />
  2692. </li>
  2693. <li>
  2694. <a id="footer" name="footer"><strong>How can I attach a
  2695. footer to my documents without using SSI?</strong></a>
  2696. <p>You can make arbitrary changes to static documents by
  2697. configuring an <a
  2698. href="../mod/mod_actions.html#action">Action</a> which
  2699. launches a CGI script. The CGI is then responsible for
  2700. setting a content-type and delivering the requested
  2701. document (the location of which is passed in the
  2702. <samp>PATH_TRANSLATED</samp> environment variable), along
  2703. with whatever footer is needed.</p>
  2704. <p>Busy sites may not want to run a CGI script on every
  2705. request, and should consider using an Apache module to add
  2706. the footer. There are several third party modules available
  2707. through the <a href="http://modules.apache.org/">Apache
  2708. Module Registry</a> which will add footers to documents.
  2709. These include mod_trailer, PHP
  2710. (<samp>php3_auto_append_file</samp>), mod_layout, and
  2711. mod_perl (<samp>Apache::Sandwich</samp>).</p>
  2712. <hr />
  2713. </li>
  2714. <li>
  2715. <a id="search" name="search"><strong>Does Apache include a
  2716. search engine?</strong></a>
  2717. <p>Apache does not include a search engine, but there are
  2718. many good commercial and free search engines which can be
  2719. used easily with Apache. Some of them are listed on the <a
  2720. href="http://www.searchtools.com/tools/tools.html">Web Site
  2721. Search Tools</a> page. Open source search engines that are
  2722. often used with Apache include <a
  2723. href="http://www.htdig.org/">ht://Dig</a> and <a
  2724. href="http://sunsite.berkeley.edu/SWISH-E/">SWISH-E</a>.</p>
  2725. <hr />
  2726. </li>
  2727. <li>
  2728. <a id="rotate" name="rotate"><strong>How can I rotate my
  2729. log files?</strong></a>
  2730. <p>The simple answer: by piping the transfer log into an
  2731. appropriate log file rotation utility.</p>
  2732. <p>The longer answer: In the src/support/ directory, you
  2733. will find a utility called <a
  2734. href="../programs/rotatelogs.html">rotatelogs</a> which can
  2735. be used like this:</p>
  2736. <pre>
  2737. TransferLog "|/path/to/rotatelogs /path/to/logs/access_log 86400"
  2738. </pre>
  2739. <p>to enable daily rotation of the log files.<br />
  2740. A more sophisticated solution of a logfile rotation
  2741. utility is available under the name <code>cronolog</code>
  2742. from Andrew Ford's site at <a
  2743. href="http://www.ford-mason.co.uk/resources/cronolog/">http://www.ford-mason.co.uk/resources/cronolog/</a>.
  2744. It can automatically create logfile subdirectories based on
  2745. time and date, and can have a constant symlink point to the
  2746. rotating logfiles. (As of version 1.6.1, cronolog is
  2747. available under the <a href="../LICENSE">Apache
  2748. License</a>). Use it like this:</p>
  2749. <pre>
  2750. CustomLog "|/path/to/cronolog --symlink=/usr/local/apache/logs/access_log /usr/local/apache/logs/%Y/%m/access_log" combined
  2751. </pre>
  2752. <hr />
  2753. </li>
  2754. <li>
  2755. <a id="conditional-logging"
  2756. name="conditional-logging"><strong>How do I keep certain
  2757. requests from appearing in my logs?</strong></a>
  2758. <p>The maximum flexibility for removing unwanted
  2759. information from log files is obtained by post-processing
  2760. the logs, or using piped-logs to feed the logs through a
  2761. program which does whatever you want. However, Apache does
  2762. offer the ability to prevent requests from ever appearing
  2763. in the log files. You can do this by using the <a
  2764. href="../mod/mod_setenvif.html#SetEnvIf"><code>SetEnvIf</code></a>
  2765. directive to set an environment variable for certain
  2766. requests and then using the conditional <a
  2767. href="../mod/mod_log_config.html#customlog-conditional"><code>
  2768. CustomLog</code></a> syntax to prevent logging when the
  2769. environment variable is set.</p>
  2770. <hr />
  2771. </li>
  2772. <li>
  2773. <a id="dbinteg" name="dbinteg"><b>Does Apache support any
  2774. sort of database integration?</b></a>
  2775. <p>No. Apache is a Web (HTTP) server, not an application
  2776. server. The base package does not include any such
  2777. functionality. See the <a href="http://www.php.net/">PHP
  2778. project</a> and the <a
  2779. href="http://perl.apache.org/">mod_perl project</a> for
  2780. examples of modules that allow you to work with databases
  2781. from within the Apache environment.</p>
  2782. <hr />
  2783. </li>
  2784. <li>
  2785. <a id="asp" name="asp"><b>Can I use Active Server Pages
  2786. (ASP) with Apache?</b></a>
  2787. <p>The base Apache Web server package does not include ASP
  2788. support. However, there are a couple of after-market
  2789. solutions that let you add this functionality; see the <a
  2790. href="http://httpd.apache.org/related_projects.html">related
  2791. projects</a> page to find out more.</p>
  2792. <hr />
  2793. </li>
  2794. <li>
  2795. <a id="java" name="java"><b>Does Apache come with Java
  2796. support?</b></a>
  2797. <p>The base Apache Web server package does not include
  2798. support for Java, Java Server Pages, Enterprise Java Beans,
  2799. or Java servlets. Those features are available as add-ons
  2800. from the Apache/Java project site, &lt;URL:<a
  2801. href="http://jakarta.apache.org">http://jakarta.apache.org/</a>&gt;.</p>
  2802. <hr />
  2803. </li>
  2804. </ol>
  2805. </body>
  2806. </html>
  2807. <hr />
  2808. <h3 align="CENTER">Apache HTTP Server Version 1.3</h3>
  2809. <a href="./"><img src="../images/index.gif" alt="Index" /></a>
  2810. <a href="../"><img src="../images/home.gif" alt="Home" /></a>
  2811. </body>
  2812. </html>