apache installation by jack davis. web servers the apache http server is the most widely used web...
Post on 19-Dec-2015
225 views
TRANSCRIPT
Apache Installationby 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. 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
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
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
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.
Example Directives
• ServerType standalone
• Port 80
• ServerAdmin [email protected]/...
• ServerName itec325server.radford.edu
• User nobody
• Group nobody
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
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 –
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
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
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
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
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
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
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.
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
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
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
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
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
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
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)
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
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
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