Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

32
Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER

Transcript of Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Page 1: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Presented byLonnye Bower

Fardin KhanChris Orona

APACHE WEB SERVER

Page 2: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Introduction and Installation of Apache

Server

Note: Images courtesy of apache.org

Page 3: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Introduction to Apache

• Apache is a web server package that works under Linux as well as under other operating systems

• The name Apache comes from the concept of extensive patching of existing code

• The primary advantage of Apache is that it is generally free or available at modest costs

Page 4: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Installing Apache

Page 5: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Installing Apache From a CD-ROM

• If your CD-ROM has Apache and you want to use RPM to install the package, issue this command– rpm –i apache_1_3_4.rpm(substitute the full name of the Apache

package)

Page 6: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Installing Apache From a Download

• Place the downloaded files in a location that will be dedicated to the Apache files, such as /usr/apache

• Uncompress the files using either gzip or tar and compress

• You must edit the configuration file– You can find more information about

this in the Readme file

Page 7: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Installing Apache… (con’t)

• Uncomment all the Modules in the configuration file except– cern_meta_module– msql_auth_module– dld_module

• Choose either db_auth_module or dbm_auth_module; they should not be used together

Page 8: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Installing Apache… (con’t)

• Create the configuration file for Linux by issuing the command– Configure

• Compile Apache by issuing the make command– The most common error message

encountered concerns the socket.h library, most likely because TCP/IP is not installed

Page 9: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Installing Apache… (con’t)

• The result of the compilation will be a binary file called httpd

• Copy this file into /bin or /usr/bin, where it will reside in the path

Page 10: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up the Website

Page 11: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up the Website

• Create the home directory for the website, we will use /usr/www/ganesan

• Create 3 subdirectories under the site directory– conf– htdocs– logs

Page 12: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up the Website (con’t)

• You will find a subdirectory called conf under the directory where you installed Apache– Copy 3 files (srm.conf-didst, access.conf-dist, http.conf-dist) from this directory into /usr/www/ganesan/conf

– If you cannot find the 3 files, use the find command to find them

Page 13: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up the Website (con’t)

• Rename the 3 files you just copied to drop the “-dist” portion of the name

• Edit the httpd.conf file to specify – the port number on which your web

server responds– the user running the httpd daemon,

etc…• Specify the server name

– ServerName ganesan.com

Page 14: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up the Website (con’t)

• Add a line that specifies the root directory for your website– DocumentRoot /usr/www/ganesan/htdocs

• Edit the srm.conf file to set up the web home directory and any special internal command usage

• Edit the access.conf file to set a basic set of access permissions

Page 15: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up the Website (con’t)

• In the htdocs directory create an HTML file for the server to read when it starts– This can be any HTML file– The filename should be default.html

• Start the httpd daemon– httpd –f /usr/www/ganesan/conf

Page 16: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up the Website (con’t)

• Test the web server by starting a browser and specify the URL http://127.0.0.1/

• If the system is working properly, you will see a screen with a list of files in the htdocs directory

Page 17: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Server Configuration

Page 18: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Server Configuration

• Make sure the ServerType directive is set to “standalone”

• Check the Port device to make sure it is set to the TCP/IP port to which your Apache server listens

• Set the User directive to either the user ID (UID) or the user name used for all web visitors

Page 19: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Server Configuration (con’t)

• Set the Group directive to either the group ID (GID) or the group name assigned to all web users

• Modify the ServerAdmin directive to include the e-mail address of the administrator

• Set the ServerRoot directive to the absolute path to the directory where all Apache resource and configuration files are stored– /usr/apache/conf or /etc/httpd

Page 20: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Server Configuration (con’t)

• Set the ServerName directive to the fully qualified domain name of your server

Page 21: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Starting and Stopping Apache

Page 22: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Starting and Stopping Apache

• If you are running Apache as a standalone server, you need to start and stop Apache manually– Start with httpd –d rootdir –f configs

– To stop Apache use ps to detect the httpd daemon’s PID and use the kill command to terminate the process

Page 23: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

A Note on Starting and Stopping Apache

• Later versions of Apache include a script that does the start and stop tasks for you

Page 24: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Virtual Hosting

Page 25: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Virtual Hosts

• A virtual host is a web server that resides on one domain but acts as if it was on another. For example, suppose you control ganesan.com and cis454.com. Instead of setting up 2 servers, you can set up a single machine that serves both domains.

• Virtual hosting saves on machinery and allows for a lot of flexibility in setting up web servers

Page 26: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up Virtual Hosting

• If your network uses a name server for DNS, modify it so that the domain name points to your web server for each domain you’ll host

• Use the ifconfig command to set up the IP address for each domain on your server– ifconfig eth0:1 xxx.xxx.xxx.xxx

Page 27: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up Virtual Hosting (con’t)

• Add the route to the network configuration using the route command– route add –host xxx.xxx.xxx.xxx dev eth0:1

• Edit the Apache httpd.conf file to set up virtual hosting– <VirtualHost www.cis454.com>DocumentRoot /usr/www/cis454/htdocsTransferLog /usr/www/cis454/logs/accessErrorLog /usr/www/cis454/logs/errors</VirtualHost>

Page 28: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Setting Up Virtual Hosting (con’t)

• The previous step defines the virtual host for cis454.com and specifies its DocumentRoot, since each virtual host will have different web directories

• If more than one virtual host is defined, the entries are to be repeated for each

Page 29: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

A Final Note

• There are many more configuration options possible with Apache, but they are usually used for commercial sites that require authentication or special handling characteristics

Page 30: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Key Terms

• Apache• conf• Server Name• Virtual Hosting• ifconfig

Page 31: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Apache Resources

• For more information on Apache go to– www.apache.org – www.apacheweek.com – dev.apache.org

Page 32: Presented by Lonnye Bower Fardin Khan Chris Orona APACHE WEB SERVER.

Thank You and Good Luck!If you have any questions regarding Apache and/or any part of this presentation, please feel free to email:

Lonnye Bower at [email protected] Orona at corona@calstatela.

eduFardin Khan at [email protected]