DOC PREVIEW
SMC CS 78 - Services: Apache – a patchy web server

This preview shows page 1-2-3-4-5-6 out of 19 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1© David Morgan 2003,2004Services: Apache –a patchy web serverDavid Morgan© David Morgan 2003,2004The Whole Business“…the whole business of a web server is to translate a URL either into a filename, and then send that file back over the Internet, or into a program name, and then run that program and send its output back. That is the meat of what it does: all the rest is trimming.”Apache, The Definitive Guide, page 12© David Morgan 2003,2004A Web Site = a Directory RedHat default: /var/www Holds “what to send” to connecting clients– content of files in: /var/www/html, or– output of programs in: /var/www/cgi-bin© David Morgan 2003,2004FILE CONTENTSubliminal messagePROGRAM OUTPUT3© David Morgan 2003,20044 important directories For HTML scripts /var/www/html For programs /var/www/cgi-bin For config files /etc/httpd/conf For logs /etc/httpd/logs -> /var/log/httpd© David Morgan 2003,2004Default directories and filesetchttpdvar/ html cgi-binerrorwwwmanualhttpd.conf noindex.html index.htmlconf logsyourwebpage files(index.html et.al.)yourexecutablesaccess_logerror_logDocumentRootServerRoot4© David Morgan 2003,2004FILE CONTENTSubliminal messagePROGRAM OUTPUT© David Morgan 2003,2004Placeholder default test page /var/www/error/noindex.html appears as long as administrator supplies no /var/www/html/index.html5© David Morgan 2003,2004Apache manual /var/www/manual/ installed by default© David Morgan 2003,2004Primary config file: httpd.conf Houses “directives” Categorized– global directives – apache process– default host directives– main “site”– virtual host directives – other (2nd, 3rd, …) sites directives number about 1506© David Morgan 2003,2004Turning services on and off Services re-read configuration files when restarted Starting– /etc/rc.d/init.d/<script for service> start or– service <script for service> start Stopping– /etc/rc.d/init.d/<script for service> stop or– service <script for service> stop© David Morgan 2003,2004Turning apache on and off Re-reads /etc/httpd/conf/httpd.conf when restarted Starting– /etc/rc.d/init.d/httpd start or– service httpd start Stopping– /etc/rc.d/init.d/httpd stop or– service httpd stop7© David Morgan 2003,2004Running programs - CGI A way to get a “page,” to send to a client Alternative to getting it out of a file (“.htm”) Instead call a program to generate it Write the program to output webpage-legal stuff CGI stands for “common gateway interface” (which could gain from improvement, as it’s creatively greatly inhibited)© David Morgan 2003,2004FILE CONTENTSubliminal messagePROGRAM OUTPUT8© David Morgan 2003,2004Running a CGI program Put the program file in /var/www/cgi-bin apache interprets files in cgi-bin as “runnables” Run by naming its URL in– “location/address” in client/browser– ACTION=<url> within an HTML FORM statement© David Morgan 2003,2004Virtual (multiple) servers IP-based– separate IP address for each virtual server Name-based– just one address for all virtual servers9© David Morgan 2003,2004IP-based: multiple IP addresses multiple physical interfaces, each with its own IP– replicate everything, or multiple “ip aliases” on a single physical interface– replicate the virtual, not the physical© David Morgan 2003,2004IP-based: number of daemons Multiple daemons– allows separate configurations– performance-expensive Single daemon– must share single configuration– performance-efficient10© David Morgan 2003,2004IP-based virtual servers<VirtualHost www.smallco.com>ServerAdmin [email protected] /groups/smallco/wwwServerName www.smallco.comErrorLog /groups/smallco/logs/error_logTransferLog /groups/smallco/logs/access_log</VirtualHost><VirtualHost www.baygroup.org>ServerAdmin [email protected] /groups/baygroup/wwwServerName www.baygroup.orgErrorLog /groups/baygroup/logs/error_logTransferLog /groups/baygroup/logs/access_log</VirtualHost>in /etc/httpd/conf/httpd.conf© David Morgan 2003,2004IP-based virtual servers Requires distinct name resolution– www.smallco.com  111.22.33.44– www.baygroup.org  111.22.33.45 Both addresses for the webserver machine Apache differentiates by address Destination address embedded in IP header11© David Morgan 2003,2004Name-based virtual serversNameVirtualHost 111.22.33.44<VirtualHost 111.22.33.44>ServerName www.domain.tldDocumentRoot /www/domain</VirtualHost><VirtualHost 111.22.33.44>ServerName www.otherdomain.tldDocumentRoot /www/otherdomain</VirtualHost>in /etc/httpd/conf/httpd.conf© David Morgan 2003,2004Name-based virtual servers Requires common name resolution– www.domain.tld  111.22.33.44– www.otherdomain.tld  111.22.33.44 Apache differentiates by name Destination name embedded in HTTP request12© David Morgan 2003,2004Differentiation by nameDestination domainname embeddedin HTTP request© David Morgan 2003,2004Differentiation by name13© David Morgan 2003,2004Some noteworthy directives Global– ServerRoot– Listen Host– User, Group– ServerAdmin– ServerName– DocumentRoot– UserDir– DirectoryIndex© David Morgan 2003,2004ServerRoot# ServerRoot: The top of the directory tree under which the server's# configuration, error, and log files are kept.#ServerRoot "/etc/httpd"from /etc/httpd/conf/httpd.conf14© David Morgan 2003,2004Listen# Listen: Allows you to bind Apache to specific IP addresses and/or# ports, in addition to the default. See also the <VirtualHost># directive.#Listen 12.34.56.78:80Listen 80from /etc/httpd/conf/httpd.conf© David Morgan 2003,2004User, Group# If you wish httpd to run as a different user or group, you must run# httpd as root initially and it will switch. ## User/Group: The name (or #number) of the user/group to run httpd as.#User apacheGroup apachefrom /etc/httpd/conf/httpd.conffrom /etc/passwddesktop:x:80:80:desktop:/var/lib/menu/kde:/sbin/nologinpostgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bashapache:x:48:48:Apache:/var/www:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinsquid:x:23:23::/var/spool/squid:/dev/null15© David Morgan 2003,2004ServerAdmin# ServerAdmin: Your address, where problems with the server should be# e-mailed. This address appears on some server-generated pages, such# as error documents. e.g.


View Full Document

SMC CS 78 - Services: Apache – a patchy web server

Download Services: Apache – a patchy web server
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Services: Apache – a patchy web server and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Services: Apache – a patchy web server 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?