Você está na página 1de 28

reference: Linux-The complete reference pdf

A web server is simply a system thats


configured to answer HTTP requests.
To convert your generic Linux system into a
web hosting platform, you install a daemon
that listens for connections on TCP port 80 (the
HTTP standard), accepts requests
for documents, and transmits them to the
requesting user
Linux distributions provide several web
servers for use on your system. The primary
web server is Apache, which has almost
become the standard web server for Linux
distributions.
It is a very powerful, stable, and fairly easy-
to-configure system.
Other web servers are also available, such as
Tux, which is smaller, but very fast and
efficient at handling web data that does not
change.
Tux, the Red Hat Content Accelerator, is a
static-content web server designed to be run
very fast from within the Linux kernel.
In effect, it runs in kernel space, making
response times much faster than standard
user-space web servers like Apache.
As a kernel-space server, Tux can handle
static content such as images very efficiently.
THE SECURE SOCKETS LAYER (SSL)
The SSL1 protocol secures communications
between a web site and a client browser.
URLs that start with https:// use this
technology. SSL uses cryptography
Apache-SSL (apache-ssl.org) is an encrypting web server based on Apache
and OpenSSL (openssl.org).

lighthttpd (lighttpd.net/) is a small, very fast, web server.

Sun Java System web server (sun.com) features Java development support
and security.
Zope application server (zope.org) is an open source web server with
integrated security, web-based administration and development, and
database interface features. It was developed by the Zope Corporation,
which also developed the Python programming language.

Stronghold Enterprise Server (redhat.com/software/stronghold) is a
commercial version of the Apache web server featuring improved security
and administration tools.

Netscape Enterprise Server (enterprise.netscape.com), part of Netscape
security solutions, features open standards with high performance.
The Apache web server is a full-featured free HTTP
(web) server developed and maintained by the Apache
Server Project.
The server software includes the server daemon,
configuration files, management tools, and
documentation
Apache was originally based on the NCSA web server
developed at the National Center for Supercomputing
Applications, University of Illinois, Urbana-
Champaign.
Apache has since emerged as a server in its own right
and become one of the most popular web servers in
use.
On most systems, Apache is installed as a
standalone server, continually running. With init
scripts, your system automatically starts up the web
server daemon, invoking it whenever you start your
system.
On Red Hat, Fedora, SUSE, and similar distributions,
you can use the chkconfig command to set the
runlevels at which the httpd server will start,
creating links in appropriate runlevel directories.
The following command will set up the web server
(httpd) to start up at runlevels 3 and 5:
chkconfig --level 35 httpd on
On Debian, Ubuntu, and similar distributions
you can use rrconf or sysv-rcconf tools.
If you do not already have Apache installed,
you can do so now by issuing the following
commands:
sudo apt-get update
sudo apt-get install apache2


On Ubuntu and Debian, Apache keeps its main configuration
files within the "/etc/apache2" folder:




apache2.conf: This is the main configuration file for the server. Almost all configuration
can be done from within this file, although it is recommended to use separate,
designated files for simplicity. This file will configure defaults and be the central point of
access for the server to read configuration details.

ports.conf: This file is used to specify the ports that virtual hosts should listen on. Be
sure to check that this file is correct if you are configuring SSL.

conf.d/: This directory is used for controlling specific aspects of the Apache
configuration. For example, it is often used to define SSL configuration and default
security choices.

sites-available/: This directory contains all of the virtual host files that define different
web sites. These will establish which content gets served for which requests. These are
available configurations, not active configurations.

sites-enabled/: This directory establishes which virtual host definitions are actually
being used. Usually, this directory consists of symbolic links to files defined in the
"sites-available" directory.



The main configuration details for your Apache
server are held in the
"/etc/apache2/apache2.conf" file.

This file is divided into three main sections:
configuration for the global Apache server
process, configuration for the default server, and
configuration of Virtual Hosts.
The global settings control the basic operation
and performance of the web server.



In Ubuntu and Debian, the majority of the file is for global
definitions, and the configuration of the default server and
virtual hosts is handled at the end, by using the "Include
..." directive.

The "Include" directive allows Apache to read other
configuration files into the current file at the location that
the statement appears. The result is that Apache
dynamically generates an overarching configuration file on
startup.

If you scroll to the bottom of the file, there are a number
of different "Include" statements. These load module
definitions, the ports.conf document, the specific
configuration files in the "conf.d/" directory, and finally,
the Virtual Host definitions in the "sites-enabled/"
directory.
This section is used to configure some options that control how Apache works as
a whole. There are some interesting options you may want to modify in this
section:

Timeout
By default, this parameter is set to "300", defines the maximum time in seconds
Apache waits for packet send and receive operations to complete
KeepAlive
This option, if set to "On", will allow each connection to remain open to handle
multiple requests from the same client. If this is set to "Off", each request will
have to establish a new connection, which can result in significant overhead
depending on your setup and traffic situation.
MaxKeepAliveRequests 100
sets the number of requests permitted per connection .
KeepAliveTimeout 15
This setting specifies how long to wait for the next request after finishing the last
one. If the timeout threshold is reached, then the connection will die. This just
means that the next time content is requested, the server will establish a new
connection to handle the request for the content that make up the page the client
is visiting.

Apache has three main configuration files: access.conf,
httpd.conf, and srm.conf.
The Apache Web server configuration file is
/etc/httpd/conf/httpd.conf. The httpd.conf file is well-
commented and somewhat self-explanatory.
The empty srm.conf and access.conf files are also in the
/etc/httpd/conf directory. The srm.conf and access.conf files
were formerly used, along with httpd.conf, as configuration files
for Apache.
If you need to configure Apache, edit httpd.conf and then either
reload, or stop and start the httpd process. How to reload, stop
and start Apache is covered in the section called Starting and
Stopping httpd.
Before you edit httpd.conf, you should first copy the original file
to something like httpd.confold, for example. By creating a
backup, you can recover potential mistakes made while editing
the new configuration file.

Certain directives are used to configure your servers
overall operations.
These directives are placed midway in the httpd.conf
configuration file, directly under the section labeled
Server Settings.
Some directives require pathnames, whereas others only
need to be turned
on or off with the keywords on and off. The default
httpd.conf file already contains these
directives.
Some are commented out with a preceding # symbol. You
can activate a directive
by removing its # sign. Many of the entries are preceded by
comments explaining their
purpose.

The following is an example of the ServerAdmin
directive used to set the address where
users can send mail for administrative issues.
You replace the you@your.address entry with
the address you want to use to receive system
administration mail. By default, this is set to
root@localhost.
# ServerAdmin: Your address, where problems
should be e-mailed.
ServerAdmin you@your.address
A web server usually uses port 80, which is
the Apache default. If you want to use
a different port, specify it with the Port
directive.
Port 80
The ServerName directive holds the hostname
for your web server. Specifying a
hostname is important to avoid unnecessary
DNS lookup failures that can hang your
server.


During the installation process, a Bourne shell script
named httpd was saved in /etc/rc.d/init.d to start
httpd automatically at boot time,
run httpd with either stop or start as an argument.

To start your server, type the command:

/etc/rc.d/init.d/httpd start

If you are running Apache as a secure server, you will
be prompted to fill in your password. After you type it
in, your server will start.




To stop your server, type the command:

/etc/rc.d/init.d/httpd stop

The command restart is a shorthand way of
stopping and then starting your server. The
restart command explicitly stops and then
starts your server. You will be prompted for
your password if you are running Apache as a
secure server.

The restart command :
/etc/rc.d/init.d/httpd
restart

If you just finished editing something in your
httpd.conf file, you do not need to explicitly
stop and start your server. Instead, you may
use the reload command.
When you use reload, you will not need to type in
your password. Your password will remain
cached across reloads, but it will not be cached
between stops and starts.
/etc/rc.d/init.d/httpd reload

By default, the httpd process will start
automatically when your machine boots. If you
are running Apache as a secure server, you will
be prompted for the secure server's password
after the machine boots,

Virtual hosting allows the Apache web server
to host multiple websites as part of its own. In
effect, the server can act as several servers,
each hosted website appearing separate to
outside users.
Apache supports both IP addressbased and
name-based virtual hosting. IP addressbased
virtual hosts use valid registered IP addresses,
whereas name-based virtual hosts use fully
qualified domain addresses.
In the IP addressbased virtual hosting method,
your server must have a different IP address for
each virtual host. The IP address you use is
already set up to reference your system. Network
system administration operations can set up your
machine to support several IP addresses.
You can configure Apache to run a separate
daemon for each virtual host, separatelylistening
for each IP address, or you can have a single
daemon running that listens for requests
for all the virtual hosts
With IP-based virtual hosting, you are limited to the
number of IP addresses your system supports. With
name-based virtual hosting, you can support any
number of virtual hosts using no additional IP
addresses. With only a single IP address for your
machine, you can still support an unlimited number
of virtual hosts. Such a capability is made possible by
the HTTP/1.1 protocol, which lets a server identify
the name by which it is being accessed. This method
requires the client, the remote user, to use a browser
that supports the HTTP/1.1 protocol, as current
browsers do (though older ones may not). A browser
using such a protocol can send a host header
specifying the particular host to use on a machine.
httpd lets your site become a web server.
httpd can send text, pictures, and sound to
its clients.

Você também pode gostar