1 / 38

Apache

CSI 227. Apache. introduction. W hat is apache? G etting it Installing it Configuring it Apache log files. what is Apache?. open source Runs on 160 + varieties of unix ? Runs on Windows too! 56% of web servers? used to be more!. get. www.apache.org/dist

sheera
Download Presentation

Apache

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSI 227 Apache

  2. introduction • What is apache? • Getting it • Installing it • Configuring it • Apache log files

  3. what is Apache? • open source • Runs on 160+ varieties of unix? • Runs on Windows too! • 56% of web servers? used to be more!

  4. get • www.apache.org/dist • some prebuilt versions with added value • Some provide support at a price • mirrored all over the world

  5. windows • Use an installer

  6. linux • Yum, similar tools for very simple installs • Example: yum install apache2

  7. from source • Get source file (something like apache.tar.gz) • gunzip apache2.tar.gz • tar xf apache2.tar • cd apache2 • ./configure • make • make install • make clean

  8. from source • gunzipor bunzip2 apache2.tar.bz2 apache2.tar.gz

  9. default build vs custom build • adding and removing modules • built-in or loaded You can select at build time to remove modules you don’t need or add others that are not included by default

  10. configuration is through a text file • httpd.conf • When you change settings with a text editor, you must then restart the server • no GUI • hundreds of directives

  11. conf files • httpd.conf • srm.conf • access.conf primary

  12. Is Apache running? • # ps –ef|grephttpd Look for processes with this name Ask what’s running

  13. Starting Apache • apachectl start

  14. Restarting Apache • apachectl restart

  15. Stopping Apache • apachectl stop

  16. Syntax Checking • checking syntax with apachectl -configtest

  17. pre-forked or multi-threaded • Pre-forked on unix (variable number of processes) • Multi-threaded on windows (2 processes)

  18. virtual hosts • Allows you to support hundreds of web sites on a single system

  19. content negotiation • apache can select the correct language to use if you have language-specific versions of pages • It can also send the preferred image format -- gif jpeg

  20. scripts etc. • run-time execution of scripts possible • SSIs allow pages to be modified at run-time before they are sent • java servletmodules are available • SSL-enabled versions are available

  21. logs • access • error • Can set up a separate log for each virtual host or one set of logs for the entire server • can be customized

  22. directives • Configuration settings are done through what are termed “directives”

  23. Listen • Listen 192.168.0.1:80 • Listen 80 • Listen *:80

  24. User and Group • Set the username and user group under which the Apache processes will run

  25. ServerName • The name reported by Apache

  26. ServerRoot • The location of Apache’s files (server executables, configuration file, etc. – not the site contents) • The locations in httpd.conf will be relative to the ServerRoot

  27. DocumentRoot • The web space (where the web pages are stored)

  28. DirectoryIndex • The list of default documents

  29. Options indexes • generates directory listing (indexes) when no matching default document s areavailable

  30. IndexOptions • provides a list of options to set various features of the index listing

  31. Alias • map a URL to a location outside document tree

  32. ErrorLog • sets logging options (e.g., LogLevel can be debug, info, notice, warn, error, crit, alert or emerg

  33. ErrorDocument • sets customized error pages • ErrorDocument 404 /error.html • ErrorDocument 500 "oops"

  34. Errors • 400 Bad Request – HTTP_BAD_REQUEST • 401 Authorization Required – HTTP_UNAUTHORIZED • 402 Payment Required – HTTP_PAYMENT_REQUIRED • 403 Forbidden – HTTP_FORBIDDEN • 404 Not Found – HTTP_NOT_FOUND • 405 Method Not Allowed – HTTP_METHOD_NOT_ALLOWED • 406 Not Acceptable – HTTP_NOT_ACCEPTABLE • 407 Proxy Authentication Required – HTTP_PROXY_AUTHENTICATION_REQUIRED • 408 Request Time-out – HTTP_REQUEST_TIME_OUT • 409 Conflict – HTTP_CONFLICT • 410 Gone – HTTP_GONE • 411 Length Required – HTTP_LENGTH_REQUIRED • 413 Request Entity Too Large – HTTP_REQUEST_ENTITY_TOO_LARGE • 414 Request-URI Too Large – HTTP_REQUEST_URI_TOO_LARGE • 500 Internal Server Error – HTTP_INTERNAL_SERVER_ERROR • 501 Method Not Implemented – HTTP_NOT_IMPLEMENTED • 503 Service Temporarily Unavailable – HTTP_SERVICE_UNAVAILABLE • 505 HTTP Version Not Supported – HTTP_VERSION_NOT_SUPPORTED • others ...

  35. Directory • set options for specific directories • <Directory /path> • Options Indexes FollowSymLinks • AllowOverrideAll • </Directory>

  36. FilesMatch • restrict access to certain files • <FilesMatch "^\.ht"> • Order allow,deny • Deny from all • </FilesMatch>

  37. Files • same as FilesMatch by regular expressions must be preceded by ~ • <Files ~ "\.(gif\jp?g\png)$"> • Order allow,deny • Allow from 192.168.0.1 • </Files>

  38. mime.types • Associate server action with a file type requested by client • requires mod_mime.so • LoadModule mime_module /modules/mod_mime.so • DefaultType text/plain • TypesConfig conf/mime.types

More Related