apache installation by jack davis. web servers the apache http server is the most widely used web...

25
Apache Installation by Jack Davis

Post on 19-Dec-2015

225 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Apache Installationby Jack Davis

Page 2: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Web Servers

• The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured. It runs on many different platforms and has a multitude of third-party modules available to expand its functionality.

• http://www.apache.org/index.html

Page 3: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Understanding Apache

• Apache source, httpd – standard set of modules, numerous header and configuration files

• compiling apache – compile the server for your architecture and purposes using the config-make-make install routine common to open source software

• the latest version of gcc or other ANSI c compiler is required

Page 4: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

How does it work?

• httpd – listens for requests and delivers files

• Apache modules are added to implement additional functionality

• A set of standard modules is delivered with the server when downloading

• httpd.conf – a text file that contains most set-up information for the server

Page 5: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

httpd.conf

• The configuration files contain directives, which are one-line commands that tell the server what to do.

• The first thing Apache needs from the configuration file are basics like the listening port, server name, the default locations for content, logs, and other important files.

Page 6: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Example Directives

• ServerType standalone

• Port 80

• ServerAdmin [email protected]/...

• ServerName itec325server.radford.edu

• User nobody

• Group nobody

Page 7: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Handling Requests

• On Unix systems – the Apache daemon httpd always starts itself as a system superuser (root).

• On Windows – the Apache service is called apache and runs with administrator privileges.

• Once started – apache listens for requests on any address and port to which it has been configured

Page 8: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Handling Requests(Continued)

• Once a request is received- apache spawns a separate process to handle the connection- the spawned process does not run as the superuser (for security reasons)- it returns files to the client- normally apache has five such processes waiting for connections –

Page 9: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Handling Requests(continued)

• all resources (html docs etc) reside under a single root directory defined by the DocumentRoot directive

• this defines the base directory that is prepended to a URL path to locate a file on the server

• more complex mapping can be defined through aliasing, redirection, URL rewriting

Page 10: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Installation Process

• make a new directory called src just below your name directory (home/jcdavis/src)

• make a new directory named apache just below your name directory (home/jcdavis/apache)

• http://www.apache.org/dist/httpd• download httpd-2.0.47.tar.gz into src

(or current version)• use gunzip to uncompress

src>gunzip < httpd-2.0*.tar.gz | tar xvf –• need to configure

src> ./configure –prefix=/home/jcdavis/apache –enable-module=so

Page 11: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Installation Process (continued)

• The purpose of the configure script is to figure out everything related to finding libraries, compile-time options, platform-specific differences, etc.

• Next have to makeapache>make

• after finished have to installapache>make install

Page 12: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Installation Process(continued)

• at the promptapache>./bin/httpd –v

• you should see the following outputServer version:Apache/2.0.47Server built: Sep 1 2002 09:20:47

• to start & stop apacheapache> apachectl start (restart) > apachectl stop

DON’T START YET, must edit config

Page 13: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Installation Process(continued)

• You must edit the httpd.conf file that is in the conf directory under apache/conf (with vim or pico)

• Here are the changes- in the # prefork MPM section MAXSPARESERVERS 10 5 MAXCLIENTS 150 50- #LISTEN CHANGE PORT NUMBER TO YOUR ASSIGNED PORT NUMBER

Page 14: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Control Commands

• apache> ./bin/apachectl start (restart)

• apache> ./bin/apachectl stop

• you should stop your server to minimize load on rucs whenever you’re not using it

• once started, open a browserhttp://rucs.radford.edu:portnumber/

• you should receive a default page from apache that is rendered in the browser

Page 15: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Configuration File

• Apache keeps all of its configuration information in text files. The main file is named httpd.conf.

• It contains directives and containers• Directives configure specific settings of

Apache, such as authorization, performance, and network parameters.

• Containers specify the context to which those settings refer.

Page 16: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Directives

• directive arguments follow the directive name.• directive arguments are separated by spaces.• number and type of arguments vary from

directive to directive.• a directive occupies a single line, but can be

continued by using a backslash \ to end the previous line

• the pound (#) sign should precede the directive and must appear on its own line

Page 17: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Documentation

• Server Documentation found athttp://httpd.apache.org/docs-2.0/

• quick reference for all directives http://httpd.apache.org/docs-2.0/mod/quickreference.html

Page 18: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Containers

• Also called sections, limit the scope for which directives apply. If directives are not inside a container, they belong to the default server scope (serverconfig) and apply to the server as a whole.

• Default Apache directive containers:- <VirtualHost> specifies a virtual server- <Directory><DirectoryMatch> directories- <Location><LocationMatch> URL’s- <Files><FilesMatch> certain files or patterns

Page 19: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Log Files

• Apache includes two log files by default- access_log is used to track client requests- error_log is used to record important events such as errors or server restarts

Page 20: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Installing PHP

• First, you must check to see that you don’t have an Ada compiler in your path variable in the .cshrc.solaris file- if you’ve been here for several years or have taken the Ada class you will have:source /usr/local/bin/ada_env near the end of the file

• you’ll have to comment out this line &log-off then log back on

Page 21: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Download the PHP files

• go to http://www.php.net/ and follow the link to the downloads section

• download the latest version of the source code, version 4.3.3 to your src directory

• again you’ll have to untar this file>tar –xvzf php-4.3.3.tar.gz

• you’ll have to move to the newly created php-4.3.3 directory, cd php-4.3.3

Page 22: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Configure

• to execute the configure script> ./configure –prefix=/home/username/php -- with-mysql=/home/mysql-php/mysql -- with-apxs2=/home/jcdavis/apache/bin/apxs

(type this in one long command, let it wrap)(remember to replace username with your username, like jrsmith)

Page 23: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Make & Install

• Issue the make command> make

• then the make install> make install

• two important files must be copied

• you’ll need to change directories:> cd /home/username/src/php4.3.3

Page 24: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Copy Files

• cp php.ini-dist /home/username/php/lib/php.ini

this copies the distributed version of php.ini to its default location

• cp libs/libphp4.so /home/username/apache/modules/(this can be all on one line with space after cp and after .so)copies the shared object file

Page 25: Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured

Test

• use http://rucs.radford.edu:portnumber/should bring up a default page from the apache server

• put in an index.php file (it’s just a standard html file and see if you add that to the request if the file displays