Apache Server Essentials Tutorial
description
Transcript of Apache Server Essentials Tutorial
![Page 2: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/2.jpg)
Topics Overview
Apache HTTP Server Overview
Apache Configuration Files
Core Apache Configuration Directives
Virtual Hosts
Error Handling
Important Apache Modules
Q & A
![Page 3: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/3.jpg)
Apache HTTP Server Overview
Free, Based On Open Source Technology.
Multiple Scripting Language Support.
Runs On * Operating Systems.
Web Server With a modular design.
Simple, Powerful file-based configuration.
![Page 4: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/4.jpg)
Apache Configuration Files
httpd.conf
access.conf ( linux )
.htaccess
.htpasswd
![Page 5: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/5.jpg)
Core Apache Configuration Directives
ServerRoot :: Apache Installation Directory Path.
ServerRoot “e:/apache2.2.11"
Listen :: IP addresses and ports that the server listens.
Listen 80Listen 10.0.2.132:9111
![Page 6: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/6.jpg)
Core Apache Configuration Directives (Cont…)
ServerAdmin :: Email Address that will be displayed in the error message when error occurs
ServerAdmin [email protected]
ServerName :: Current Server Name & Port
ServerName localhost:80
ServerAlias :: Alternate Names for accessing virtual hosts.
ServerAlias alias-1 alias-2
![Page 7: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/7.jpg)
Core Apache Configuration Directives (Cont…)
DocumentRoot :: Main Document Directory as displayed on the Web Site.
DocumentRoot “E:/wwwroot”
NameVirtualHost :: Designates an IP address for name-virtual host
NameVirtualHost *:2125NameVirtualHost 10.0.2.132:9111
![Page 8: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/8.jpg)
Core Apache Configuration Directives (Cont…)
LoadModule :: Load Specific Apache Module.
LoadModule test_module modules/mod_test.so
Include:: Includes other configuration files in the server configuration file.
Include “test.conf”Include “e:/wwwroot/aliases/*.conf”
![Page 9: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/9.jpg)
Core Apache Configuration Directives (Cont…)
IFModule :: Allows Module Specific Configurations.
<IfModule module_name>
Module Specific Configurations
</IfModule>
<IfModule !module_name>
Module Specific Configurations
</IfModule>
![Page 10: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/10.jpg)
Core Apache Configuration Directives (Cont…)
IFModule (Cont...) ::
<IfModule !autoindex_module>
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm
</IfModule>
</IfModule>
![Page 11: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/11.jpg)
Core Apache Configuration Directives (Cont…)
Directory :: Allows group of directives applied to directory
<Directory “E:/wwwroot/">
List of directives………………….………………..
</Directory>
![Page 12: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/12.jpg)
Determines who is allowed to access the website and who is kept out.
Access can be granted based on following criteria ::
• IP Address / Domain Name• Date & Time• Other User Defined Criteria
Core Apache Configuration Directives (Cont…)
Access Control Directives ::
![Page 13: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/13.jpg)
Core Apache Configuration Directives (Cont…)
Order :: Defines ordering for allow & deny
Order Allow,DenyOrder Deny,Allow
Allow :: Allows access from given IP Address or Domain Name
Allow From allAllow From 192.168
Deny :: Deny access from given IP Address or Domain Name
Deny From 192.168
![Page 14: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/14.jpg)
<Directory “E:/wwwroot/protected”>
Order allow,denyAllow from allDeny from 192.168.
</Directory>
Apache Configuration File
.htaccess Order allow,denyAllow from allDeny from 192.168.
Core Apache Configuration Directives (Cont…)
![Page 15: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/15.jpg)
Core Apache Configuration Directives (Cont…)
FileMatch :: Allows to define Access Rights for specific files.
<FilesMatch "^\.ht"> Order allow,deny
Deny from all</FilesMatch>
<FilesMatch "\.pdf$"> Order allow,deny
Deny from all</FilesMatch>
![Page 16: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/16.jpg)
Core Apache Configuration Directives (Cont…)
ErrorLog :: Error log File Location
ErrorLog err-log-file location
TransferLog :: Access Log File Location
TransferLog access-log-file location
CustomLog :: Custom Log File with custom Log Format
CustomLog custom-log-file location Log-Format
![Page 17: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/17.jpg)
Core Apache Configuration Directives (Cont…)
AuthType :: Type Of User Authentication
AuthType Basic | Digest
AuthUserFile :: File name which contains username and password
AuthUserFile <Directory>/FileName
![Page 18: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/18.jpg)
Core Apache Configuration Directives (Cont…)
AuthName :: Authorization Title used in HTTP Authentication
AuthName Authentication Title
Require :: Defines Type of Users/groups that can access Contents. Access Types can be :: group | user | valid-user.
Require [Access Type] [ Access Name ]
Require group admin
![Page 19: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/19.jpg)
Virtual Hosts
Allows more than one websites to run on the same physical server & Apache Server.
Two Types Of Virtual Hosts can be created ::
IP-based Virtual Hosts Name-based Virtual Hosts
![Page 20: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/20.jpg)
Virtual Host Related Directives
<VirtualHost [IP ADDRESS:PORT] >
ServerAdmin
DocumentRoot
ServerName
ServerAlias
ErrorLog
</ VirtualHost >
![Page 21: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/21.jpg)
Listen 2125NameVirtualHost *:2125
<VirtualHost localhost:2125> ServerAdmin [email protected] DocumentRoot "E:\wwwroot\zfBasics" ServerName localhost</VirtualHost>
Listen 9111NameVirtualHost *:9111
<VirtualHost *:9111> ServerAdmin [email protected] DocumentRoot "E:\wwwroot\addressbook“</VirtualHost>
Common Virtual Host Examples
![Page 22: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/22.jpg)
NameVirtualHost *:80
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "E:\wwwroot\zfManual" ServerName www.zendframeworkmanual.com ServerAlias zendframeworkmanual.com</VirtualHost>
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "E:\wwwroot\demo" ServerName www.example.com ServerAlias example.com</VirtualHost>
Server Virtual Host Examples
![Page 23: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/23.jpg)
Error Handling
Apache Server generates Status Codes depending on the Page/URL Request.
• 301 Moved Permanently
• 401 Unauthorized
• 403 Forbidden
• 404 Not Found
• 500 Internal Server Error
![Page 24: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/24.jpg)
ErrorDocument :: Allows to define Custom Error Pages
ErrorDocument StatusCode <Custom Error Page Location>
ErrorDocument 401 /error401.html
ErrorDocument 403 /errordocs/error403.php
ErrorDocument 404 http://www.yousite.com/error.php
Error Handling (Cont…)
![Page 25: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/25.jpg)
Important Apache Modules
mod_ssl
mod_rewrite
mod_expires
mod_autoindex
mod_deflate
mod_headers
mod_includemod_dir
mod_envmod_alias
mod_cgi
mod_proxy
mod_log_config
mod_mime mod_fastcgi
mod_auth
![Page 26: Apache Server Essentials Tutorial](https://reader034.fdocuments.net/reader034/viewer/2022042601/5468a837b4af9f0e518b4804/html5/thumbnails/26.jpg)
Q & A ::