Apache Server

Download Report

Transcript Apache Server

Presented by
Lonnye Bower
Fardin Khan
Chris Orona
Introduction and Installation of
Apache Server
Note: Images courtesy of apache.org
Introduction to Apache
• Apache is a web server package that works
under Linux as well as under other operating
• 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
Installing Apache
Installing Apache From a CDROM
• 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)
Installing Apache From a
• 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
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
Installing Apache… (con’t)
• Create the configuration file for Linux
by issuing the command
– Configure
• Compile Apache by issuing the make
– The most common error message
encountered concerns the socket.h library,
most likely because TCP/IP is not installed
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
Setting Up the Website
Setting Up the Website
• Create the home directory for the
website, we will use
• Create 3 subdirectories under the site
– conf
– htdocs
– logs
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.confdist) from this directory into
– If you cannot find the 3 files, use the find
command to find them
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
– the user running the httpd daemon, etc…
• Specify the server name
– ServerName ganesan.com
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
Setting Up the Website (con’t)
• In the htdocs directory create an
HTML file for the server to read when it
– This can be any HTML file
– The filename should be default.html
• Start the httpd daemon
– httpd –f /usr/www/ganesan/conf
Setting Up the Website (con’t)
• Test the web server by starting a
browser and specify the URL
• If the system is working properly, you
will see a screen with a list of files in the
htdocs directory
Server Configuration
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
Server Configuration (con’t)
• Set the Group directive to either the group ID
(GID) or the group name assigned to all web
• 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
Server Configuration (con’t)
• Set the ServerName directive to the
fully qualified domain name of your
Starting and Stopping Apache
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
– To stop Apache use ps to detect the httpd
daemon’s PID and use the kill command
to terminate the process
A Note on Starting and Stopping
• Later versions of Apache include a
script that does the start and stop tasks
for you
Virtual Hosting
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
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
– ifconfig eth0:1 xxx.xxx.xxx.xxx
Setting Up Virtual Hosting
• 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/htdocs
ErrorLog /usr/www/cis454/logs/errors
Setting Up Virtual Hosting
• 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
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
Key Terms
Server Name
Virtual Hosting
Apache Resources
• For more information on Apache go to
– www.apache.org
– www.apacheweek.com
– dev.apache.org
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]
Chris Orona at [email protected]
Fardin Khan at [email protected]