Lines 23-28
Link Here
|
23 |
<version>1.0</version> |
23 |
<version>1.0</version> |
24 |
<date>2005-05-17</date> |
24 |
<date>2005-05-17</date> |
25 |
|
25 |
|
|
|
26 |
<!-- |
27 |
TODO: add content on more configuration and possibly a FAQ |
28 |
|
29 |
--> |
30 |
|
26 |
<chapter> |
31 |
<chapter> |
27 |
<title>Introduction</title> |
32 |
<title>Introduction</title> |
28 |
<section> |
33 |
<section> |
Lines 31-58
Link Here
|
31 |
|
36 |
|
32 |
<p> |
37 |
<p> |
33 |
Apache is by far the most popular web server on the Internet. As of February |
38 |
Apache is by far the most popular web server on the Internet. As of February |
34 |
2005 Netcraft has reported more than 68% of sites surveyed use Apache. Due to |
39 |
2005, Netcraft has reported more than 68% of sites surveyed use Apache. |
35 |
it's open source nature and wide popularity it stands to reason why shouldn't |
|
|
36 |
a guide for apache installation should be made. |
37 |
</p> |
40 |
</p> |
38 |
|
41 |
|
39 |
<p> |
42 |
<p> |
40 |
This guide is ultimately aimed at the home user who wants to put up a |
43 |
This guide is ultimately aimed at the home user who wants to put up a |
41 |
personal webpage from home. With the widespread increase of broadband and |
44 |
personal webpage from home. With the widespread increase of broadband and |
42 |
Linux, more and more people can start putting up personal webpages for |
45 |
GNU/Linux, more and more people can start putting up personal webpages for |
43 |
blogging, home-made picture albums, hobby sites, etc. |
46 |
blogging, home-made picture albums, hobby sites, etc. |
44 |
</p> |
47 |
</p> |
45 |
|
48 |
|
46 |
<p> |
49 |
<p> |
47 |
Average users may think operating your own HTTP server is a lot more |
50 |
Average users may think operating your own HTTP server is a lot more |
48 |
difficult and time consuming than it really is but the truth is if you just |
51 |
difficult and time consuming than it really is; the truth is if you just want |
49 |
want to host pictures of the family then it really is not difficult. |
52 |
static content, it is not too difficult. |
50 |
</p> |
53 |
</p> |
51 |
|
54 |
|
52 |
<p> |
55 |
<p> |
53 |
Users should consider this guide a general, quick and easy way to get started |
56 |
Users should consider this guide a general, quick, and easy way to get started |
54 |
with Apache. Full-blown websites involve a lot of work in configuring and |
57 |
with Apache. Full-blown websites involve a lot of work in configuring and |
55 |
securing but this guide will make it easy for users to get started with the |
58 |
securing, but this guide will make it easy for users to get started with the |
56 |
basics. |
59 |
basics. |
57 |
</p> |
60 |
</p> |
58 |
|
61 |
|
Lines 63-81
Link Here
|
63 |
<chapter> |
66 |
<chapter> |
64 |
<title>Installing Apache</title> |
67 |
<title>Installing Apache</title> |
65 |
<section> |
68 |
<section> |
66 |
<title>Getting Started</title> |
69 |
<title>Apache Versions</title> |
67 |
<body> |
70 |
<body> |
68 |
|
71 |
|
69 |
<p> |
72 |
<p> |
70 |
Fortunately, Apache is available in portage and users are urged to get the |
73 |
There are two main versions of apache currently in use - apache1 and apache2. |
71 |
latest version available in portage so that the latest stable bug fixes and |
74 |
Gentoo provides ebuilds for both of these; we will be using apache2. Apache1 is |
72 |
security patches are installed. |
75 |
primarily used for situations where a special mod or very unusual config is |
|
|
76 |
used, and we will be using neither. |
73 |
</p> |
77 |
</p> |
74 |
|
78 |
|
75 |
<pre caption="Grabbing the latest version"> |
|
|
76 |
# <i>emerge sync</i> |
77 |
</pre> |
78 |
|
79 |
</body> |
79 |
</body> |
80 |
</section> |
80 |
</section> |
81 |
<section> |
81 |
<section> |
Lines 84-90
Link Here
|
84 |
|
84 |
|
85 |
<p> |
85 |
<p> |
86 |
Generally, there are going to be a couple USE flags the user should be aware |
86 |
Generally, there are going to be a couple USE flags the user should be aware |
87 |
of before emerging Apache. Please enable the following flags that apply. |
87 |
of before emerging Apache. Please enable the following flags as needed. |
88 |
</p> |
88 |
</p> |
89 |
|
89 |
|
90 |
<table> |
90 |
<table> |
Lines 98-104
Link Here
|
98 |
</tr> |
98 |
</tr> |
99 |
<tr> |
99 |
<tr> |
100 |
<ti>ssl</ti> |
100 |
<ti>ssl</ti> |
101 |
<ti>Enable SSL support for webpages</ti> |
101 |
<ti>Enable Secure Socket Layer support for webpages</ti> |
102 |
</tr> |
102 |
</tr> |
103 |
<tr> |
103 |
<tr> |
104 |
<ti>berkdb</ti> |
104 |
<ti>berkdb</ti> |
Lines 111-125
Link Here
|
111 |
</table> |
111 |
</table> |
112 |
|
112 |
|
113 |
<note> |
113 |
<note> |
114 |
If you do not know what any of the above flag descriptions are referring to |
114 |
If you do not know what any of the above flag descriptions are referring to, |
115 |
then it is ok to ignore them. If at a later time the need arises for any of |
115 |
then it is ok to ignore them, as you probably don't need them. If at a later |
116 |
the above flags you can always enable the flag and re-emerge Apache. |
116 |
time the need arises for any of the above flags you can always enable the flag |
|
|
117 |
and re-emerge Apache. |
117 |
</note> |
118 |
</note> |
118 |
|
119 |
|
119 |
<p> |
120 |
<pre caption="Editing /etc/make.conf"> |
120 |
Please add the appropiate USE flags to your <path>/etc/make.conf</path> file |
121 |
<comment>(Add the following, as needed)</comment> |
121 |
under the USE category. |
122 |
USE="ipv6 ssl berkdb ldap" |
122 |
</p> |
123 |
</pre> |
123 |
|
124 |
|
124 |
</body> |
125 |
</body> |
125 |
</section> |
126 |
</section> |
Lines 129-136
Link Here
|
129 |
|
130 |
|
130 |
<p> |
131 |
<p> |
131 |
Compile time will vary from system to system but if you need a general |
132 |
Compile time will vary from system to system but if you need a general |
132 |
estimate on compile time, an AMD 1.33Ghz Thunderbird with 512mb of RAM takes |
133 |
estimate on compile time, an AMD 1.33Ghz t-bird with 512mb of RAM takes about |
133 |
about 10 min. |
134 |
10 min. |
134 |
</p> |
135 |
</p> |
135 |
|
136 |
|
136 |
<pre caption="Emerging Apache"> |
137 |
<pre caption="Emerging Apache"> |
Lines 148-156
Link Here
|
148 |
<body> |
149 |
<body> |
149 |
|
150 |
|
150 |
<p> |
151 |
<p> |
151 |
After Apache has been emerged the user should be made aware of how to |
152 |
In this Chapter, basic configuration options will be given. The main |
152 |
configure the Apache server. In this Chapter basic configuration options |
153 |
configuration file is located at <path>/etc/apache2/conf/apache2.conf</path>. |
153 |
will be given. The main configuration file is located at <path>/etc/apache2/conf/apache2.conf</path>. |
154 |
All of the following modifications will be made in that file! |
154 |
</p> |
155 |
</p> |
155 |
|
156 |
|
156 |
<p>The first thing users will want to do is to select an IP address and Port |
157 |
<p>The first thing users will want to do is to select an IP address and Port |
Lines 160-178
Link Here
|
160 |
<note>Selecting an IP and Port for Apache to listen on is called Binding.</note> |
161 |
<note>Selecting an IP and Port for Apache to listen on is called Binding.</note> |
161 |
|
162 |
|
162 |
<pre caption="Configuring which IP/Port to Listen on"> |
163 |
<pre caption="Configuring which IP/Port to Listen on"> |
163 |
<comment># The listen directive is what is used to choose IP/Port.</comment> |
164 |
<comment> |
164 |
<comment># Most users only have 1 IP address on their computer so the only</comment> |
165 |
# The listen directive is what is used to choose IP/Port. Most users only have |
165 |
<comment># thing that needs to be set is the Port. The following will set</comment> |
166 |
# 1 IP address on their computer so the only thing that needs to be set is the |
166 |
<comment># Apache to listen in on Port 80. There is no need to specify</comment> |
167 |
# Port. The following will set Apache to listen in on Port 80. There is no need |
167 |
<comment># an IP address since there is only 1 available on the computer.</comment> |
168 |
# to specify an IP address since there is only 1 available on the computer. |
|
|
169 |
</comment> |
168 |
Listen 80 |
170 |
Listen 80 |
169 |
|
171 |
|
170 |
<comment># If the user would like Apache to listen on another port in addition</comment> |
172 |
<comment> |
171 |
<comment># to port 80 then add another Listen line. Apache now listens on</comment> |
173 |
# If the user would like Apache to listen on another port in addition to port |
172 |
<comment># Port 8000 and Port 80 if the user kept both lines in the config.</comment> |
174 |
# 80 then add another Listen line. Apache now listens on Port 8000 and Port 80 |
|
|
175 |
# if the user kept both lines in the config. |
176 |
</comment> |
173 |
Listen 8000 |
177 |
Listen 8000 |
174 |
|
178 |
|
175 |
<comment># If users have multiple IPs then the following syntax can be used.</comment> |
179 |
<comment> |
|
|
180 |
# If users have multiple IPs then the following syntax can be used. |
181 |
</comment> |
176 |
Listen 192.168.0.20:80 |
182 |
Listen 192.168.0.20:80 |
177 |
Listen 192.168.0.150:8000 |
183 |
Listen 192.168.0.150:8000 |
178 |
</pre> |
184 |
</pre> |
Lines 189-199
Link Here
|
189 |
</p> |
195 |
</p> |
190 |
|
196 |
|
191 |
<pre caption="Setting HTTP file location"> |
197 |
<pre caption="Setting HTTP file location"> |
192 |
<comment># This is the default location in the config file</comment> |
198 |
<comment> |
|
|
199 |
# This is the default location in the config file |
200 |
</comment> |
193 |
DocumentRoot /var/www/localhost/htdocs |
201 |
DocumentRoot /var/www/localhost/htdocs |
194 |
|
202 |
|
195 |
<comment># The location could be changed to a directory located in a user's</comment> |
203 |
<comment> |
196 |
<comment># home directory as follows.</comment> |
204 |
# The location could be changed to a directory located in a user's home |
|
|
205 |
# directory as follows. |
206 |
</comment> |
197 |
DocumentRoot /home/user/www |
207 |
DocumentRoot /home/user/www |
198 |
</pre> |
208 |
</pre> |
199 |
|
209 |
|
Lines 204-211
Link Here
|
204 |
<body> |
214 |
<body> |
205 |
|
215 |
|
206 |
<p> |
216 |
<p> |
207 |
If the user would like Apache to startup each time the Linux system is brought |
217 |
If the user would like Apache to startup each time the Gentoo system is brought |
208 |
up then adding Apache to the runlevel is needed. |
218 |
up, adding Apache to the runlevel is needed. |
209 |
</p> |
219 |
</p> |
210 |
|
220 |
|
211 |
<pre caption="Adding Apache to startup"> |
221 |
<pre caption="Adding Apache to startup"> |
Lines 219-235
Link Here
|
219 |
<body> |
229 |
<body> |
220 |
|
230 |
|
221 |
<p> |
231 |
<p> |
222 |
By now the user has the very basics setup for Apache and now all that is |
232 |
By now the user has very basic setup for Apache and now all that is needed is |
223 |
needed is for the user to add whatever files he or she chooses. The document |
233 |
for the user to add whatever files he or she chooses. The document root for |
224 |
root for all Apache files is located at <path>/var/www/localhost/htdocs</path> |
234 |
all Apache files is located at <path>/var/www/localhost/htdocs</path> if the |
225 |
if the user kept the default path location mentioned in this guide. |
235 |
user kept the default path location mentioned in this guide. |
226 |
</p> |
236 |
</p> |
227 |
|
237 |
|
228 |
<p> |
238 |
<p> |
229 |
For now the user does not have to place anything in the DocumentRoot location. |
239 |
For now, the user does not have to place anything in the DocumentRoot location. |
230 |
HTTP related files can be inserted whenever but for now the default files at |
240 |
HTTP related files can be inserted whenever, but the default files at |
231 |
<path>/var/www/localhost/htdocs</path> are more than enough to get an idea |
241 |
<path>/var/www/localhost/htdocs</path> are more than enough to get an idea of |
232 |
of how to start. |
242 |
how to start. |
233 |
</p> |
243 |
</p> |
234 |
|
244 |
|
235 |
</body> |
245 |
</body> |
Lines 246-254
Link Here
|
246 |
# <i>/etc/init.d/apache2 start</i> |
256 |
# <i>/etc/init.d/apache2 start</i> |
247 |
</pre> |
257 |
</pre> |
248 |
|
258 |
|
249 |
<p> |
259 |
<note> |
250 |
Apache can just as easily be brought down with the following command. |
260 |
Apache can just as easily be brought down with the following command. |
251 |
</p> |
261 |
</note> |
252 |
|
262 |
|
253 |
<pre caption="Stopping Apache"> |
263 |
<pre caption="Stopping Apache"> |
254 |
# <i>/etc/init.d/apache2 stop</i> |
264 |
# <i>/etc/init.d/apache2 stop</i> |
Lines 267-280
Link Here
|
267 |
</p> |
277 |
</p> |
268 |
|
278 |
|
269 |
<p> |
279 |
<p> |
270 |
Users should open up their favorite browser and enter in 127.0.0.1 into the |
280 |
Users should open up their favorite browser and enter in <c>127.0.0.1</c> as |
271 |
browser address. The browser should immediately load a default page stating |
281 |
the browser address. The browser should immediately load a default page stating |
272 |
in the first sentence that the installation of the Apache web server is a |
282 |
in the first sentence that the installation of the Apache web server is a |
273 |
success. |
283 |
success. |
274 |
</p> |
284 |
</p> |
275 |
|
285 |
|
276 |
<note>The user can also enter in their IP as listed in ifconfig usually on |
286 |
<note> |
277 |
eth0. </note> |
287 |
The user can also enter in their IP as listed in ifconfig; this is usually |
|
|
288 |
eth0. |
289 |
</note> |
278 |
|
290 |
|
279 |
</body> |
291 |
</body> |
280 |
</section> |
292 |
</section> |
Lines 285-302
Link Here
|
285 |
<p> |
297 |
<p> |
286 |
If the user would like to setup an Apache server for testing and would like |
298 |
If the user would like to setup an Apache server for testing and would like |
287 |
to restrict access to just the local computer it can easily be done by using |
299 |
to restrict access to just the local computer it can easily be done by using |
288 |
the Listen directive in the apache2.conf. |
300 |
the Listen directive in the <path>apache2.conf</path>. |
289 |
</p> |
301 |
</p> |
290 |
|
302 |
|
291 |
<pre caption="Restricting Access to localhost only"> |
303 |
<pre caption="Restricting Access to localhost only"> |
292 |
<comment># 127.0.0.1 is the local loopback address to your computer</comment> |
304 |
<comment> |
|
|
305 |
# 127.0.0.1 is the local loopback address to your computer |
306 |
</comment> |
293 |
Listen 127.0.0.1:80 |
307 |
Listen 127.0.0.1:80 |
294 |
</pre> |
308 |
</pre> |
295 |
|
309 |
|
296 |
</body> |
310 |
</body> |
297 |
</section> |
311 |
</section> |
298 |
<section> |
312 |
<section> |
299 |
<title>Keeping track of your Apache</title> |
313 |
<title>Keeping track of Apache</title> |
300 |
<body> |
314 |
<body> |
301 |
|
315 |
|
302 |
<p> |
316 |
<p> |
Lines 345-355
Link Here
|
345 |
</table> |
359 |
</table> |
346 |
|
360 |
|
347 |
<p> |
361 |
<p> |
348 |
To actively monitor the Apache log file on say a desktop, users can use a |
362 |
To actively monitor the Apache log file, execute the following command: |
349 |
xterm and execute the following command. |
|
|
350 |
</p> |
363 |
</p> |
351 |
|
364 |
|
352 |
<pre caption="Using a Xterm to monitor the Apache log"> |
365 |
<pre caption="Monitoring the Apache log"> |
353 |
# <i>tail -f /var/log/apache2/error_log</i> |
366 |
# <i>tail -f /var/log/apache2/error_log</i> |
354 |
</pre> |
367 |
</pre> |
355 |
|
368 |
|
Lines 360-371
Link Here
|
360 |
<body> |
373 |
<body> |
361 |
|
374 |
|
362 |
<p> |
375 |
<p> |
363 |
Congratulations to the user for a painless quick start on Apache. |
376 |
Congratulations for a painless quick start on Apache. |
364 |
</p> |
|
|
365 |
|
366 |
<p> |
367 |
Users are encouraged to check back on this guide for more updates concerning |
368 |
Apache user and configuration. Possible future content include a FAQ. |
369 |
</p> |
377 |
</p> |
370 |
|
378 |
|
371 |
<p> |
379 |
<p> |