Presentation is loading. Please wait.

Presentation is loading. Please wait.

Apache Configuration Setting up a web server. Basic Server Facts Runs on port 80 Server application -> httpd Richly configurable Many defaults will let.

Similar presentations


Presentation on theme: "Apache Configuration Setting up a web server. Basic Server Facts Runs on port 80 Server application -> httpd Richly configurable Many defaults will let."— Presentation transcript:

1 Apache Configuration Setting up a web server

2 Basic Server Facts Runs on port 80 Server application -> httpd Richly configurable Many defaults will let it run out of the box Runs on many platforms –primarily unix (linux) –also on Windows Documentation : www.apache.org

3 Typical Browser/Server Interaction Browser (netscape) Server (apache) 1. Broswer requests document 2. Server fetches file from local disk 3. Server returns “html” formatted file to browser 4. Browser renders the html file on the client screen Disk

4 Major Considerations Configuration files /parameters Site information User information Performance tuning parameters Feature “flags”.. cgi / ssi Basic Security URL rewriting

5 Dynamic Content CGI Forms SSI JavaScript MySQL (database server) Active X

6 Installing www.apache.org recompile OR package manager configuration usually in: – 3 main files httpd.conf - server attributes srm.conf- root of the document (site) tree access.conf- who can use it –a file per directory.htaccess- (more to come)

7 File locations (typical) / usr local docroot home apache bin conf... srm.conf httpd.confaccess.conf d1 d2.htaccess.conf These OVERRIDE these

8 Overriding internal configuration locations Typically compiled into the binary. Override with compile time parameters /usr/local/apache/bin/httpd -f /usr/local/apache/myconf/httpd.conf alternate location http://httpd.apache.org/docs-2.0/invoking.html Starting

9 Use apachect to control start restart configtest stop graceful e.g. apachectl start http://httpd.apache.org/docs-2.0/stopping.html Stopping

10 Configuration Files and Scope of Directive Directory and subdirectories of that directory Numerous directives apply here. See online examples http://httpd.apache.org/docs-2.0/mod/core.html#directory EXAMPLE: Options Indexes FollowSymLinks

11 docroot home d1 d2 / (.htaccess) subd1 subd2 subd3 declare here valid in all subdirectories below AllowOverride will determine if lower directories can make changes (possibly undo above directives) Scope of Directive

12 Primary Configuration Directives 3 main directives – directives use regular expressions Directives take precedence in complex order Only in server or virtual host Allowed in.htaccess too

13 (order of activiation) (except regular expressions) and.htaccess done simultaneously (with.htaccess overriding ), and with regular expressions and done simultaneously Config file order:httpd.conf, srm.conf and access.conf Multiple directives appear to override previous ones

14 Server Wide Configuration DocumentRoot –http://www.pcs.cnu.edu –where does it look for files? ServerRoot –way to reposition server config file: logs.conf etc. DirectoryIndex –index.html home.html index.shtml …...

15 Virtual Hosts Multiple names served by a single server E.g. ISP serves many clients/names Done on basis of IP and Name Consider only simple examples –(Next slide)

16 Example Virtual Host Config Port 80 ServerName server.domain.tld NameVirtualHost * DocumentRoot /www/domain ServerName www.domain.tld... DocumentRoot /www/subdomain ServerName www.sub.domain.tld...

17 Some Security Concerns http://httpd.apache.org/docs-2.0/misc/security_tips.html ServerRoot Directives should be owned and altered only by root. SSI and CGI present major security risks suEXEC is a tool which allows CGIs and SSIs to run as a user other that the same user running the web server (typically root) Deny users from overriding server settings Deny users all files then allow specific directories

18 URL Rewrite Rules How does the server translate your url into a file on your system? How about users and cgi? Rewrite module allows you to specify translation rules to use. Relies heavily on regular expressions. See Home directories example.

19 Example Rewrite Rules RewriteRule ^/~([^/]+)/?(.*) /u/$1/$2 [R] RewriteRule ^/([uge])/([^/]+)$ /$1/$2/ [R] Begins with /~ followed by one or more characters not a / followed by zer or one / (?) followed by any number of other characters Begins with /~ followed a u or g or e followed by anyhing NOT terminated with a /is essentially terminated by a slash


Download ppt "Apache Configuration Setting up a web server. Basic Server Facts Runs on port 80 Server application -> httpd Richly configurable Many defaults will let."

Similar presentations


Ads by Google