📄 485-486.html
字号:
<HTML>
<HEAD>
<TITLE>Using Linux:Managing Daemons</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0789716232//-->
<!--TITLE=Using Linux//-->
<!--AUTHOR=William Ball//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=28//-->
<!--PAGES=485-486//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="482-484.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch29/487-490.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading20"></A><FONT COLOR="#000077">Enabling a Web Server</FONT></H3>
<P>The stock web server that Red Hat Linux ships with is Apache. This is the most popular web server used on the Internet by a large margin, and is fast and relatively efficient. It’s not unreasonable to use Linux as a high-volume web server with Apache, and a great many sites on the Internet run this combination.
</P>
<P>To set up Apache on your system, ensure that you have the correct package installed:</P>
<DL>
<DD><B>1.</B> Confirm that Apache is installed on your system by issuing the command <TT>rpm -q apache</TT> at the command line. If the system reports that the package is not installed, you must install it before proceeding.
<DD><B>2.</B> Although Apache can be run under the auspices of <TT>inetd</TT>, this is not common. Web clients are an impatient bunch, and the added time it takes for <TT>inetd</TT> to start Apache to handle a request for each connection adds too much wait time for all but the least-loaded web servers. Apache is usually started as a regular daemon, and is left to manage itself after that. Use <TT>chkconfig</TT> to see if the service <TT>httpd</TT> (the generic name for web services) is started: <TT>chkconfig--list httpd</TT>. If the service is listed as <TT>on</TT> for the run level where your system is (probably 3), then Apache starts for this run level.
<DD><B>3.</B> If <TT>httpd</TT> is not configured to start for your run level, typing <TT>chkconfig httpd reset</TT> should set up Apache to run in the run levels in which it should be running.
<DD><B>4.</B> If you’re sure that Apache was not started when the system last entered your current run level, you can start it manually by giving the command <TT>/etc/rc.d/init.d/httpd start</TT>. Watch for error messages.
<DD><B>5.</B> Test your web server by starting a web client on your machine, such as <TT>lynx</TT> for text mode, or Netscape for X11, and going to address <TT>http://localhost</TT>. You should get the page entitled “It Worked!”
</DL>
<P>The files that your web server reads by default are in <TT>/home/httpd/html</TT>.</P>
<H4 ALIGN="LEFT"><A NAME="Heading21"></A><FONT COLOR="#000077">Configuring the Apache Web Server</FONT></H4>
<P>Apache’s configuration files are kept in <TT>/etc/httpd/conf</TT>.</P>
<P><TT>httpd.conf</TT> contains the main server configuration. You may need to change the <TT>ServerName</TT> directive for the server if, when started, the server responds with the message <TT>Unable to resolve host name</TT> or <TT>Unable to determine local host name</TT>. This file typically contains other server-specific settings used to fine-tune the server, such as the minimum and maximum number of servers processes to run at the same time, and the number of requests each server should process before terminating. Each server process services one request at once, so it’s important to keep these numbers appropriate to the load on the server.</P>
<P><TT>srm.conf</TT> contains information for Apache on how to handle different file types, and which directory to treat as the root directory for the server.</P>
<P><TT>access.conf</TT> contains all the access control options for all the directories on the server. With <TT>access.conf</TT> it is possible, for example, to exclude certain addresses from accessing the server, or certain directories on the server.</P>
<P>These files are very well commented and each setting is documented in detail. If you point your web browser at <TT>localhost</TT> (or if you are on another machine, the Linux machine’s host name) and follow the links to Apache Documentation, you see the most current documentation that shipped with the version of the server that is installed.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="482-484.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch29/487-490.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -