Apache - Training

Download Report

Transcript Apache - Training

Day 15
Apache
Being a web server
• Once your system is correctly connected to the
network, you could be a web server.
– When you go to a web site such as http://www.cnn.com
– You are connecting to a machine which has web server
software running on it.
• If the machine is running Windows, you are most likely talking
to IIS server.
• If it is running Unix of some form, you are most likely talking
to Apache server.
• Netscape also makes web servers, many people use them also,
they are available for both windows and Unix.
Apache
• Apache is nothing more than a daemon which listens
on port TCP 80 for incoming requests.
• It then serves appropriate files from your hard drive
in response to those requests.
Document Root
• All web servers have a notion of a document root.
– This is the only place on the hard drive that users on the
web can request documents from.
– This protect average files from being viewed across the
internet.
– The web server will upon startup immediately run a
chroot command to prevent itself from being tricked into
looking at parts of the hard drive it doesn’t have
permissions to.
Permissions
• All files in the document root should probably be
world readable.
– The apache daemon actually runs as a user [typically
“nobody”] and as long as that user has permission to
view the files, they will be available on the web.
Starting/Stopping Apache
• Apache runs as a regular process, just like anything
else.
• Usually called
– httpd
• You could kill it, however you are advised to use the
commands:
– apache start
– apache stop
• To start or stop it. This gives apache a chance to
update some other stuff.
Configuring Apache
• Apache will create a directory into which it will put
all its files:
– Usually either:
• /usr/local/apache
• /var/httpd/
• In the directory, you will find a conf directory, and
in there you will find a httpd.conf file.
• This is where all configuration options of Apache
are set.
Apache logs.
• The log files for apache are stored in
– /var/log/httpd/access.log
– /var/log/httpd/errors.log
• These are rotated and removed as often as you tell it
to.