]> granicus.if.org Git - apache/blob - docs/manual/getting-started.xml
xforms
[apache] / docs / manual / getting-started.xml
1 <?xml version='1.0' encoding='UTF-8' ?>
2 <!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
3 <?xml-stylesheet type="text/xsl" href="./style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <manualpage metafile="getting-started.xml.meta">
24
25   <title>Getting Started</title>
26
27 <summary>
28 <p>If you're completely new to the Apache HTTP Server, or even to running
29 a website at all, you might not know where to start, or what questions to
30 ask. This document walks you through the basics.</p>
31 </summary>
32
33 <section id="clientserver">
34 <title>Clients, Servers, and URLs</title>
35
36 <p>
37 Addresses on the Web are expressed with URLs - Uniform Resource Locators
38 - which specify a protocol (e.g. <code>http</code>), a servername (e.g.
39 <code>www.apache.org</code>), a URL-path (e.g.
40 <code>/docs/current/getting-started.html</code>), and possibly a query
41 string (e.g. <code>?arg=value</code>) used to pass additional
42 arguments to the server. 
43 </p>
44
45 <p>A client (e.g., a web browser) connects to a server (e.g., your Apache HTTP Server), 
46 with the specified protocol, and makes a <strong>request</strong> for a resource using the
47 URL-path.</p>
48
49 <p>The URL-path may represent any number of things on the server. It may
50 be a file (like <code>getting-started.html</code>) a handler (like <a
51 href="mod/mod_status.html">server-status</a>) or some kind of program
52 file (like <code>index.php</code>). We'll discuss this more below in
53 the <a href="#content">Web Site Content</a> section.</p>
54
55 <p>
56 The server will send a <strong>response</strong> consisting of a status
57 code and, optionally, a response body.
58 The status code indicates whether the request was successful, and, if not, what
59 kind of error condition there was. This tells the client what it should
60 do with the response. You can read about the possible response codes in
61 <a href="http://wiki.apache.org/httpd/CommonHTTPStatusCodes">HTTP Server
62 wiki</a>.</p>
63
64 <p>Details of the transaction, and any error conditions, are written to
65 log files. This is discussed in greater detail below in the <a
66 href="#logs">Logs Files and Troubleshooting</a> section.</p>
67
68 </section>
69
70 <section id="dns">
71 <title>Hostnames and DNS</title>
72
73 <p>In order to connect to a server, the client will first have to resolve
74 the servername to an IP address - the location on the Internet where the
75 server resides. Thus, in order for your web server to be reachable, it
76 is necessary that the servername be in DNS.</p>
77
78 <p>More than one hostname may point to the same IP address, and more
79 than one IP address can be attached to the same physical server. Thus, you
80 can run more than one web site on the same physical server, using a
81 feature called <a href="vhosts/">virtual hosts</a>.</p>
82
83 <p>If you don't know how to do this, you'll need to contact your network
84 administrator, or Internet service provider, to perform this step for
85 you.</p>
86
87 <p>If you are testing a server that is not Internet-accessible, you
88 can put host names in your hosts file in order to do local resolution.
89 For example, you might want to put a record in your hosts file to map a
90 request for <code>www.example.com</code> to your local system, for
91 testing purposes. This entry would look like:</p>
92
93 <example>
94 127.0.0.1 www.example.com
95 </example>
96
97 <p>A hosts file will probably be located at <code>/etc/hosts</code> or
98 <code>C:\Windows\system32\drivers\etc\hosts</code>.</p>
99
100 <p>You can read more about the hosts file at <a
101 href="http://en.wikipedia.org/wiki/Hosts_(file)">Wikipedia.org/wiki/Hosts_(file)</a>, and
102 more about DNS at <a
103 href="http://en.wikipedia.org/wiki/Domain_Name_System">Wikipedia.org/wiki/Domain_Name_System</a>.</p>
104 </section>
105
106 <section id="configuration">
107 <title>Configuration Files and Directives</title>
108
109 <p>The Apache HTTP Server is configured via simple text files.
110 These files may be located any of a variety of places, depending on how
111 exactly you installed the server. Common locations for these files may
112 be found <a href="http://wiki.apache.org/httpd/DistrosDefaultLayout">in
113 the httpd wiki</a>. If you installed httpd from source, the default
114 location of the configuration files is
115 <code>/usr/local/apache2/conf</code>. The default configuration file is
116 usually called <code>httpd.conf</code>. This, too, can vary in
117 third-party distributions of the server.</p>
118
119 <p>The configuration is frequently broken into multiple smaller files,
120 for ease of management. These files are loaded via the <directive
121 module="core">Include</directive> directive. The names or locations of
122 these sub-files are not magical, and may vary greatly from one
123 installation to another. Arrange and subdivide these files as
124 makes the most sense to <strong>you</strong>. If the file arrangement
125 you have by default doesn't make sense to you, feel free to rearrange it.</p>
126
127 <p>The server is configured by placing <a
128 href="mod/quickreference.html">configuration directives</a> in these
129 configuration files. A directive is a keyword followed by one or more
130 arguments that set its value.</p>
131
132 <p>The question of "<em>Where should I put that
133 directive?</em>" is generally answered by considering where you want a
134 directive to be effective. If it is a global setting, it should appear
135 in the configuration file, outside of any <directive
136 type="section">Directory</directive>, <directive
137 type="section">Location</directive>, <directive
138 type="section">VirtualHost</directive>, or other section. If it is to
139 apply only to a particular directory, then it should go inside a
140 <directive type="section">Directory</directive> section referring to
141 that directory, and so on. See the <a href="sections.html">Configuration
142 Sections</a> document for further discussion of these sections.</p>
143
144 <p>In addition to the main configuration files, certain directives may go in
145 <code>.htaccess</code> files located in the content directories.
146 <code>.htaccess</code> files are primarily for people who do not have
147 access to the main server configuration file(s). You can read more about
148 <code>.htaccess</code> files in the <a
149 href="howto/htaccess.html"><code>.htaccess</code> howto</a>.</p>
150
151 </section>
152
153 <section id="content">
154 <title>Web Site Content</title>
155
156 <p>Web site content can take many different forms, but may be broadly
157 divided into static and dynamic content.</p>
158
159 <p>Static content is things like HTML files, image files, CSS files,
160 and other files that reside in the filesystem. The <directive
161 module="core">DocumentRoot</directive> directive specifies where in your
162 filesystem you should place these files. This directive is either set
163 globally, or per virtual host. Look in your configuration file(s) to
164 determine how this is set for your server.</p>
165
166 <p>Typically, a document called <code>index.html</code> will be served
167 when a directory is requested without a file name being specified. For
168 example, if <code>DocumentRoot</code> is set to
169 <code>/var/www/html</code> and a request is made for
170 <code>http://www.example.com/work/</code>, the file
171 <code>/var/www/html/work/index.html</code> will be served to the
172 client.</p>
173
174 <p>Dynamic content is anything that is generated at request
175 time, and may change from one request to another. There are numerous
176 ways that dynamic content may be generated. Various <a
177 href="handler.html">handlers</a> are available to generate content. <a
178 href="howto/cgi.html">CGI programs</a> may be written to generate
179 content for your site.</p>
180
181 <p>Third-party modules like mod_php may be used to write code that does a
182 variety of things. Many third-party applications, written using a
183 variety of languages and tools, are available for download and
184 installation on your Apache HTTP Server. Support of these third-party
185 things is beyond the scope of this documentation, and you should find
186 their documentation or other support forums to answer your questions
187 about them.</p>
188 </section>
189
190 <section id="logs">
191 <title>Log Files and Troubleshooting</title>
192 <p>As an Apache HTTP Server administrator, your most valuable assets are
193 the log files, and, in particular, the error log. Troubleshooting any
194 problem without the error log is like driving with your eyes closed.</p>
195
196 <p>The location of the error log is defined by the <directive
197 module="core">ErrorLog</directive> directive, which may be set globally,
198 or per virtual host. Entries in the error log tell you what went wrong,
199 and when. They often also tell you how to fix it. Each error log message
200 contains a error code, which you can search for online for even more
201 detailed descriptions of how to address the problem. You can also
202 configure your error log to contain a log ID which you can then
203 correlate to an access log entry, so that you can determine what request
204 caused the error condition.</p>
205
206 <p>You can read more about logging in the <a href="logs.html">logs
207 documentation</a>.</p>
208 </section>
209
210 <section id="other">
211 <title>What Else Do I Need To Know?</title>
212 <p>This document covers only the bare basics. We hope that this gets you
213 started, but there are many other things that you might need to know.
214 Here's a partial list of what you might be looking for:</p>
215
216 <ul>
217 <li><a href="howto/auth.html">Authentication and Authorization (password protecting resources)</a></li>
218 <li><a href="howto/access.html">Access Control</a></li>
219 <li><a href="ssl/ssl_howto.html">Setting up SSL</a></li>
220 <li><a href="http://wiki.apache.org/httpd/FAQ">Frequently Asked Questions</a></li>
221 </ul>
222
223 </section>
224
225 </manualpage>