Apache2 Ubuntu Default Page: It works · Apache2 Ubuntu Default Page: It works
Apache2 BootCamp : Using Apache to Serve Static Content
-
Upload
wildan-maulana -
Category
Technology
-
view
510 -
download
3
Transcript of Apache2 BootCamp : Using Apache to Serve Static Content
![Page 1: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/1.jpg)
Day #2Using Apache to Serve Static Content
Wildan [email protected]
http://workshop.openthinklabs.com
#5
![Page 2: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/2.jpg)
Overview
● How to configure Apache to listen on different IP addresses and ports
● How to organize the URL space with directory aliasing and redirection
● How to customize the server information and error messages
![Page 3: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/3.jpg)
Addresses, Ports, and Server Names
Listen ipaddress:port
ServerName UseCanonicalName
![Page 4: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/4.jpg)
Customizing the Web Server
● Error Messages● International Error Messages● Handling URL Errors: mod_speling
● Customizing Server Information● Server Identification● Contact Information
![Page 5: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/5.jpg)
Customizing the Web ServerError Messages
ErrorDocument
ErrorDocument 500 http://foo.example.com/cgi-bin/testerErrorDocument 404 /cgi-bin/bad_urls.plErrorDocument 401 /subscription_info.htmlErrorDocument 403 "Sorry can't allow you access today"
![Page 6: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/6.jpg)
Customizing the Web ServerInternational Error Messages
Server Side Includes (mod_include) and content negotiation (mod_negotiation).
Custom Error Codes
![Page 7: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/7.jpg)
Customizing the Web ServerHandling URL Errors: mod_speling
CheckSpelling
![Page 8: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/8.jpg)
Customizing the Web ServerServer Identification & Contact Information
ServerTokens Options
Settings Output
ServerTokens ProductOnly Apache
ServerTokens Minimal Apache/2.0.28
ServerTokens OS Apache/2.0.28 (Unix)
ServerTokens Full Apache/2.0.28 (Unix) SSL/2.0. 0
ServerSignature On/Off
ServerAdmin [email protected]
![Page 9: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/9.jpg)
Aliasing and Mapping of Resources
Alias /icons/ /usr/local/apache2/icons/
AliasMatch ^/help(.*) /usr/local/apache/htdocs/manual$1
![Page 10: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/10.jpg)
URL Redirection
Redirect temp /news/ http://example.com/latest/news/
![Page 11: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/11.jpg)
MIME Types
● Directives :● TypesConfig● AddType
– AddType text/xml xml● DefaultType
● MIME Type List
![Page 12: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/12.jpg)
MIME Magic
mod_mime_magic
MimeMagicFile
![Page 13: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/13.jpg)
The ForceType Directive
<Location /images/>ForceType image/gif</Location>
![Page 14: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/14.jpg)
Content Handlers
AddHandler
RemoveHandler SetHandler
![Page 15: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/15.jpg)
Directory Listings
DirectoryIndex index.html index.htm
mod_autoindex
Default Document Index
Directory Indexing
![Page 16: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/16.jpg)
Forbidding Directory Access
● Disable the mod_autoindex● Use the Options-Indexes directive● Use IndexIgnore directive.
![Page 18: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/18.jpg)
Icons for Bookmarks
AliasMatch /favicon.ico /usr/local/apache2/icons/site.ico
Icon
![Page 19: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/19.jpg)
Q&Ahttp://workshop.openthinklabs.com/resources
![Page 20: Apache2 BootCamp : Using Apache to Serve Static Content](https://reader033.fdocuments.us/reader033/viewer/2022042607/55aacf1f1a28abe87a8b46d6/html5/thumbnails/20.jpg)
Reference
● Daniel Lopez Ridruezo; SAMS Teach Yourself Apache2 in 24 Hours, SAMS Publishing, 2002 (Buy this book on Amazon)