1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5              This file is generated from xml source: DO NOT EDIT
6        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7      -->
8<title>Getting Started - Apache HTTP Server</title>
9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
12<script src="/style/scripts/prettify.min.js" type="text/javascript">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body id="manual-page"><div id="page-header">
17<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
18<p class="apache">Apache HTTP Server Version 2.4</p>
19<img alt="" src="/images/feather.gif" /></div>
20<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
21<div id="path">
22<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="./">Version 2.4</a></div><div id="page-content"><div id="preamble"><h1>Getting Started</h1>
23<div class="toplang">
24<p><span>Available Languages: </span><a href="/en/getting-started.html" title="English">&nbsp;en&nbsp;</a> |
25<a href="/fr/getting-started.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a></p>
26</div>
27
28<p>If you're completely new to the Apache HTTP Server, or even to running
29a website at all, you might not know where to start, or what questions to
30ask. This document walks you through the basics.</p>
31</div>
32<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#clientserver">Clients, Servers, and URLs</a></li>
33<li><img alt="" src="/images/down.gif" /> <a href="#dns">Hostnames and DNS</a></li>
34<li><img alt="" src="/images/down.gif" /> <a href="#configuration">Configuration Files and Directives</a></li>
35<li><img alt="" src="/images/down.gif" /> <a href="#content">Web Site Content</a></li>
36<li><img alt="" src="/images/down.gif" /> <a href="#logs">Log Files and Troubleshooting</a></li>
37<li><img alt="" src="/images/down.gif" /> <a href="#other">What Else Do I Need To Know?</a></li>
38</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
39<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
40<div class="section">
41<h2><a name="clientserver" id="clientserver">Clients, Servers, and URLs</a></h2>
42
43
44<p>
45Addresses on the Web are expressed with URLs - Uniform Resource Locators
46- which specify a protocol (e.g. <code>http</code>), a servername (e.g.
47<code>www.apache.org</code>), a URL-path (e.g.
48<code>/docs/current/getting-started.html</code>), and possibly a query
49string (e.g. <code>?arg=value</code>) used to pass additional
50arguments to the server.
51</p>
52
53<p>A client (e.g., a web browser) connects to a server (e.g., your Apache HTTP Server),
54with the specified protocol, and makes a <strong>request</strong> for a resource using the
55URL-path.</p>
56
57<p>The URL-path may represent any number of things on the server. It may
58be a file (like <code>getting-started.html</code>) a handler (like <a href="mod/mod_status.html">server-status</a>) or some kind of program
59file (like <code>index.php</code>). We'll discuss this more below in
60the <a href="#content">Web Site Content</a> section.</p>
61
62<p>
63The server will send a <strong>response</strong> consisting of a status
64code and, optionally, a response body.
65The status code indicates whether the request was successful, and, if not, what
66kind of error condition there was. This tells the client what it should
67do with the response. You can read about the possible response codes in
68<a href="http://wiki.apache.org/httpd/CommonHTTPStatusCodes">HTTP Server
69wiki</a>.</p>
70
71<p>Details of the transaction, and any error conditions, are written to
72log files. This is discussed in greater detail below in the <a href="#logs">Logs Files and Troubleshooting</a> section.</p>
73
74</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
75<div class="section">
76<h2><a name="dns" id="dns">Hostnames and DNS</a></h2>
77
78
79<p>In order to connect to a server, the client will first have to resolve
80the servername to an IP address - the location on the Internet where the
81server resides. Thus, in order for your web server to be reachable, it
82is necessary that the servername be in DNS.</p>
83
84<p>If you don't know how to do this, you'll need to contact your network
85administrator, or Internet service provider, to perform this step for
86you.</p>
87
88<p>More than one hostname may point to the same IP address, and more
89than one IP address can be attached to the same physical server. Thus, you
90can run more than one web site on the same physical server, using a
91feature called <a href="vhosts/">virtual hosts</a>.</p>
92
93<p>If you are testing a server that is not Internet-accessible, you
94can put host names in your hosts file in order to do local resolution.
95For example, you might want to put a record in your hosts file to map a
96request for <code>www.example.com</code> to your local system, for
97testing purposes. This entry would look like:</p>
98
99<div class="example"><p><code>
100127.0.0.1 www.example.com
101</code></p></div>
102
103<p>A hosts file will probably be located at <code>/etc/hosts</code> or
104<code>C:\Windows\system32\drivers\etc\hosts</code>.</p>
105
106<p>You can read more about the hosts file at <a href="http://en.wikipedia.org/wiki/Hosts_(file)">Wikipedia.org/wiki/Hosts_(file)</a>, and
107more about DNS at <a href="http://en.wikipedia.org/wiki/Domain_Name_System">Wikipedia.org/wiki/Domain_Name_System</a>.</p>
108</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
109<div class="section">
110<h2><a name="configuration" id="configuration">Configuration Files and Directives</a></h2>
111
112
113<p>The Apache HTTP Server is configured via simple text files.
114These files may be located any of a variety of places, depending on how
115exactly you installed the server. Common locations for these files may
116be found <a href="http://wiki.apache.org/httpd/DistrosDefaultLayout">in
117the httpd wiki</a>. If you installed httpd from source, the default
118location of the configuration files is
119<code>/usr/local/apache2/conf</code>. The default configuration file is
120usually called <code>httpd.conf</code>. This, too, can vary in
121third-party distributions of the server.</p>
122
123<p>The configuration is frequently broken into multiple smaller files,
124for ease of management. These files are loaded via the <code class="directive"><a href="/mod/core.html#include">Include</a></code> directive. The names or locations of
125these sub-files are not magical, and may vary greatly from one
126installation to another. Arrange and subdivide these files as
127makes the most sense to <strong>you</strong>. If the file arrangement
128you have by default doesn't make sense to you, feel free to rearrange it.</p>
129
130<p>The server is configured by placing <a href="mod/quickreference.html">configuration directives</a> in these
131configuration files. A directive is a keyword followed by one or more
132arguments that set its value.</p>
133
134<p>The question of "<em>Where should I put that
135directive?</em>" is generally answered by considering where you want a
136directive to be effective. If it is a global setting, it should appear
137in the configuration file, outside of any <code class="directive">&lt;Directory&gt;</code>, <code class="directive">&lt;Location&gt;</code>, <code class="directive">&lt;VirtualHost&gt;</code>, or other section. If it is to
138apply only to a particular directory, then it should go inside a
139<code class="directive">&lt;Directory&gt;</code> section referring to
140that directory, and so on. See the <a href="sections.html">Configuration
141Sections</a> document for further discussion of these sections.</p>
142
143<p>In addition to the main configuration files, certain directives may go in
144<code>.htaccess</code> files located in the content directories.
145<code>.htaccess</code> files are primarily for people who do not have
146access to the main server configuration file(s). You can read more about
147<code>.htaccess</code> files in the <a href="howto/htaccess.html"><code>.htaccess</code> howto</a>.</p>
148
149</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
150<div class="section">
151<h2><a name="content" id="content">Web Site Content</a></h2>
152
153
154<p>Web site content can take many different forms, but may be broadly
155divided into static and dynamic content.</p>
156
157<p>Static content is things like HTML files, image files, CSS files,
158and other files that reside in the filesystem. The <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code> directive specifies where in your
159filesystem you should place these files. This directive is either set
160globally, or per virtual host. Look in your configuration file(s) to
161determine how this is set for your server.</p>
162
163<p>Typically, a document called <code>index.html</code> will be served
164when a directory is requested without a file name being specified. For
165example, if <code>DocumentRoot</code> is set to
166<code>/var/www/html</code> and a request is made for
167<code>http://www.example.com/work/</code>, the file
168<code>/var/www/html/work/index.html</code> will be served to the
169client.</p>
170
171<p>Dynamic content is anything that is generated at request
172time, and may change from one request to another. There are numerous
173ways that dynamic content may be generated. Various <a href="handler.html">handlers</a> are available to generate content. <a href="howto/cgi.html">CGI programs</a> may be written to generate
174content for your site.</p>
175
176<p>Third-party modules like mod_php may be used to write code that does a
177variety of things. Many third-party applications, written using a
178variety of languages and tools, are available for download and
179installation on your Apache HTTP Server. Support of these third-party
180things is beyond the scope of this documentation, and you should find
181their documentation or other support forums to answer your questions
182about them.</p>
183</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
184<div class="section">
185<h2><a name="logs" id="logs">Log Files and Troubleshooting</a></h2>
186
187<p>As an Apache HTTP Server administrator, your most valuable assets are
188the log files, and, in particular, the error log. Troubleshooting any
189problem without the error log is like driving with your eyes closed.</p>
190
191<p>The location of the error log is defined by the <code class="directive"><a href="/mod/core.html#errorlog">ErrorLog</a></code> directive, which may be set globally,
192or per virtual host. Entries in the error log tell you what went wrong,
193and when. They often also tell you how to fix it. Each error log message
194contains a error code, which you can search for online for even more
195detailed descriptions of how to address the problem. You can also
196configure your error log to contain a log ID which you can then
197correlate to an access log entry, so that you can determine what request
198caused the error condition.</p>
199
200<p>You can read more about logging in the <a href="logs.html">logs
201documentation</a>.</p>
202</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
203<div class="section">
204<h2><a name="other" id="other">What Else Do I Need To Know?</a></h2>
205
206<p>This document covers only the bare basics. We hope that this gets you
207started, but there are many other things that you might need to know.
208Here's a partial list of what you might be looking for:</p>
209
210<ul>
211<li><a href="howto/auth.html">Authentication and Authorization (password protecting resources)</a></li>
212<li><a href="howto/access.html">Access Control</a></li>
213<li><a href="ssl/ssl_howto.html">Setting up SSL</a></li>
214<li><a href="http://wiki.apache.org/httpd/FAQ">Frequently Asked Questions</a></li>
215</ul>
216
217</div></div>
218<div class="bottomlang">
219<p><span>Available Languages: </span><a href="/en/getting-started.html" title="English">&nbsp;en&nbsp;</a> |
220<a href="/fr/getting-started.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a></p>
221</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
222<script type="text/javascript"><!--//--><![CDATA[//><!--
223var comments_shortname = 'httpd';
224var comments_identifier = 'http://httpd.apache.org/docs/2.4/getting-started.html';
225(function(w, d) {
226    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
227        d.write('<div id="comments_thread"><\/div>');
228        var s = d.createElement('script');
229        s.type = 'text/javascript';
230        s.async = true;
231        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
232        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
233    }
234    else { 
235        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
236    }
237})(window, document);
238//--><!]]></script></div><div id="footer">
239<p class="apache">Copyright 2014 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
240<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
241if (typeof(prettyPrint) !== 'undefined') {
242    prettyPrint();
243}
244//--><!]]></script>
245</body></html>