18
Day #2 Getting Started with Apache Wildan Maulana [email protected] http://workshop.openthinklabs.com #4

Apache2 BootCamp : Getting Started With Apache

Embed Size (px)

Citation preview

Page 2: Apache2 BootCamp : Getting Started With Apache

Overview

● The steps necessary to have a minimal Apache installation up and running; for example, changing basic server properties such as name and port information

● How to start and stop Apache and how to troubleshoot basic problems

Page 3: Apache2 BootCamp : Getting Started With Apache

Layout of Server Files and Directories

Section Windows Unix

Default install path C:\Program Files\Apache Group\Apache2

/usr/local/apache2

Binaries and support scripts

bin/apache.exebin/

bin/httpdbin/

Log files log/error.loglog/access.loglog/httpd.pid

log/error_loglog/access_loglog/httpd.pid

Proxy proxy/ proxy/

Configuration files conf/httpd.conf conf/httpd.conf

CGI scripts cgi-bin/test-cgi.bat cgi-bin/test-cgi

Build information and header files

Does not apply in binary installation

Include/build/

Page 4: Apache2 BootCamp : Getting Started With Apache

Layout of Server Files and Directories (2)

Section Windows Unix

Error messages error/ error/

Modules and libraries modules/bin/

modules/lib/

HTML documents htdocs/ htdocs/

Icons icons/ icons/

Manual manual/ manual/

Page 5: Apache2 BootCamp : Getting Started With Apache

Configuration Files Structure

● DirectivesDirectives configure specific settings of Apache, such as authorization, performance, and network parameters.

● ContainersContainers specify the context to which those settings refer. For example, authorization configuration can refer to the server as a whole, a directory, or a single file.

Page 6: Apache2 BootCamp : Getting Started With Apache

Sample Container Directives

<Directory “/some/directory”> SomeDirective1 SomeDirective2</Directory><Location “/downloads/*.html”> SomeDirective3</Location><Files “\.(gif|jpg)”> SomeDirective4 </Files>

Page 7: Apache2 BootCamp : Getting Started With Apache

Conditional Evaluation

<IfDefine MyModule> LoadModule my_module modules/libmymodule.so</IfDefine>

apache2.exe -DMyModule

Page 8: Apache2 BootCamp : Getting Started With Apache

Conditional Evaluation (2)<IfModule prefork.c> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 20 MaxRequestsPerChild 0</IfModule>

<IfModule worker.c> StartServers 3 MaxClients 8 MinSpareThreads 5 MaxSpareThreads 10 ThreadsPerChild 25 MaxRequestsPerChild 0</IfModule>

Directives in an IfModule section will be processed only if the modulepassed as an argument is present in the Web server

Page 9: Apache2 BootCamp : Getting Started With Apache

ServerRoot

● The ServerRoot directive takes a single argument: a directory path pointing to the directory where the server lives

ServerRoot /usr/local/apache

Page 10: Apache2 BootCamp : Getting Started With Apache

Including Additional Configuration Files

Include conf/ssl.conf

Page 11: Apache2 BootCamp : Getting Started With Apache

Per-Directory Configuration Files

.htaccess

AccessFileName directive

<Directory /> AllowOverride none</Directory>

Disabling Per-Directory Configuration Files

Page 12: Apache2 BootCamp : Getting Started With Apache

Minimal Apache Configuration

httpd.conf

Page 13: Apache2 BootCamp : Getting Started With Apache

Log Files

● access_log

● error_log

Page 14: Apache2 BootCamp : Getting Started With Apache

Apache-Related Commands

apache2 -h

Page 15: Apache2 BootCamp : Getting Started With Apache

Controlling Apache on Windows

● Apache.exe -k restart : Tells Apache to restart● Apache.exe -k graceful: Tells Apache to do a

graceful restart● Apache.exe -k stop: Tells Apache to stop

Page 16: Apache2 BootCamp : Getting Started With Apache

Troubleshooting

● Existing Web Server● No Permission to Bind to Port● Access Denied● Wrong Group Settings

Page 18: Apache2 BootCamp : Getting Started With Apache

Reference

● Daniel Lopez Ridruezo; SAMS Teach Yourself Apache2 in 24 Hours, SAMS Publishing, 2002 (Buy this book on Amazon)