📄 ch51.htm
字号:
<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>
-->
<font face="Arial,Helvetica" size="-1" color="#006666">
<b>Linux</b></font><p>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<UL>
<LI><A HREF="#Heading1">- 51 -</A>
<UL>
<LI><A HREF="#Heading2">Setting Up WWW Services</A>
<UL>
<LI><A HREF="#Heading3">Web Server Software</A>
<LI><A HREF="#Heading4">NOTE</A>
<UL>
<LI><A HREF="#Heading5">Unpacking the Web Files</A>
<LI><A HREF="#Heading6">Compiling the Web Software</A>
<LI><A HREF="#Heading7">Configuring the Web Software</A>
<LI><A HREF="#Heading8">Starting the Web Software</A>
</UL>
<LI><A HREF="#Heading9">Setting Up Your Web Site</A>
<UL>
<LI><A HREF="#Heading10">HTML Authoring Tools</A>
</UL>
<LI><A HREF="#Heading11">NOTE</A>
<LI><A HREF="#Heading12">NOTE</A>
<LI><A HREF="#Heading13">NOTE</A>
<LI><A HREF="#Heading14">NOTE</A>
<LI><A HREF="#Heading15">NOTE</A>
<UL>
<LI><A HREF="#Heading16">Maintaining HTML</A>
</UL>
<LI><A HREF="#Heading17">NOTE</A>
<LI><A HREF="#Heading18">Summary</A>
</UL>
</UL>
</UL>
<P>
<HR SIZE="4">
<H2 ALIGN="CENTER"><A NAME="Heading1<FONT COLOR="#000077">- 51 -</FONT></H2>
<H2 ALIGN="CENTER"><A NAME="Heading2<FONT COLOR="#000077">Setting Up WWW Services</FONT></H2>
<P><I>by Tim Parker</I></P>
<P>IN THIS CHAPTER</P>
<UL>
<LI>Web Server Software
<P>
<LI>Setting Up Your Web Site
</UL>
<P>Just about everyone on the planet knows about the World Wide Web. It's the most
talked about aspect of the Internet. With the Web's popularity, more system users
are getting into the game by setting up their own WWW servers and home pages. There
are now sophisticated packages that act as Web servers for many operating systems.
Linux, based on UNIX, has the software necessary to provide a Web server.</P>
<P>You don't need fancy software to set up a Web site, only a little time and the
correct configuration information. That's what this chapter is about. We look at
how you can set up a World Wide Web server on your Linux system--whether for friends,
your LAN, or the Internet as a whole.</P>
<P>The major aspect of the Web that attracts users and makes it so powerful, aside
from its multi-media capabilities, is the use of hyperlinks. A hyperlink lets one
mouse click move you from document to document, site to site, graphic to movie, and
so on. All the instructions of the move are built into the Web code.</P>
<P>There are two main aspects to the World Wide Web: server and client. Client software,
such as Mosaic and Netscape, is probably the most familiar. However, many different
Web client packages other than these two are also available, some specifically for
X or Linux.
<H3 ALIGN="CENTER"><A NAME="Heading3<FONT COLOR="#000077">Web Server Software</FONT></H3>
<P>There are three primary versions of Web server software that will run under Linux.
They are from NCSA, CERN, and Plexus. The most readily available system is from NCSA,
which also produces Mosaic. NCSA's Web system is fast and quite small, can run under
<TT>inetd</TT> or as a standalone daemon, and provides pretty good security. For
this chapter, we will use NCSA's Web software, although you can easily use either
of the other two packages instead (although the configuration information will be
different, of course).
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading4<FONT COLOR="#000077"><B>NOTE:</B> </FONT>The Web server software
for one of the three is available via anonymous FTP or WWW from one of the sites
listed here, depending on the type of server software you want:
<TABLE BORDER="0" HEIGHT="192">
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="63" ALIGN="LEFT" VALIGN="TOP">CERN:<BR>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<BLOCKQUOTE>
<P><TT>ftp//ftp.w3.org/pub/httpd</TT> (FTP)
</BLOCKQUOTE>
<P>
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="63" ALIGN="LEFT" VALIGN="TOP">NCSA:<BR>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<BLOCKQUOTE>
<P><TT>ftp.ncsa.uiuc.edu/web/httpd/unix/ncsa_httpd</TT> (FTP)<BR>
<TT>http://hoohoo.ncsa.uiuc.edu</TT> (WWW)
</BLOCKQUOTE>
<P>
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="63" ALIGN="LEFT" VALIGN="TOP">Plexus:<BR>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<BLOCKQUOTE>
<P><TT>ftp://austin.bsdi.com/plexus/2.2.1/dist/Plexus-2.2.1.tar.Z</TT> (WWW).
</BLOCKQUOTE>
<P>
</TD>
</TR>
</TABLE>
<BR>
<HR>
<BR>
<BR>
The NCSA Web software is available for Linux in both compiled and source code forms.
Using the compiled version is much easier because you don't have to configure and
compile the source code for the Linux platform. The binaries are often provided compressed
and tarred, so you will have to uncompress and then extract the <TT>tar</TT> library.
Alternatively, many CD-ROMs provide the software ready-to-go. If you do obtain the
compressed form of the Web server software, follow the installation or <TT>README</TT>
files to place the Web software in the proper location.
</DL>
<BLOCKQUOTE>
<CENTER>
<H4><A NAME="Heading5<FONT COLOR="#000077">Unpacking the Web Files</FONT></H4>
</CENTER>
<P>If you have obtained a library of source code or binaries from an FTP or BBS site,
you probably have to untar and uncompress them first. (Check with any <TT>README</TT>
files, if there are any, before you do this; otherwise you may be doing this step
for nothing.) Usually, you will proceed by creating a directory for the Web software,
and then changing into it and expanding the library with a command such as this:<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">zcat httpd_X.X_XXX.tar.Z | tar xvf -
</FONT></PRE>
<P>The software is often named by the release and target platform, such as <TT>httpd_1.5_linux.tar.Z</TT>.
Use whatever name your <TT>tar</TT> file has in the preceding line. Installation
instructions are sometimes in a separate <TT>tar</TT> file, such as <TT>Install.tar.z</TT>,
which you have to obtain and uncompress with the following command:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">zcat Install.tar.z
</FONT></PRE>
<P>Make sure you are in the target directory when you issue these commands, though,
or you will have to move a lot of files. You can place the files anywhere; however,
it is often a good idea to create a special area for the Web software that can have
its permissions controlled, such as <TT>/usr/web</TT>, <TT>/var/web</TT>, or a similar
name.</P>
<P>Once you have extracted the contents of the Web server distribution and the library
files are in their proper directories, you can look at what has been created automatically.
You should find the following subdirectories:
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="63" ALIGN="LEFT"><TT>cgi-bin</TT> </TD>
<TD ALIGN="LEFT">Common gateway interface binaries and scripts. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="63" ALIGN="LEFT"><TT>conf</TT> </TD>
<TD ALIGN="LEFT">Configuration files. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="63" ALIGN="LEFT"><TT>icons</TT> </TD>
<TD ALIGN="LEFT">Icons for home pages. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="63" ALIGN="LEFT"><TT>src</TT> </TD>
<TD ALIGN="LEFT">Source code and (sometimes) executables. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="63" ALIGN="LEFT"><TT>support<BR>
</TT></TD>
<TD ALIGN="LEFT">Support applications.<BR>
</TD>
</TR>
</TABLE>
<CENTER>
<H4><A NAME="Heading6<FONT COLOR="#000077">Compiling the Web Software</FONT></H4>
</CENTER>
<P>If you don't have to modify the source and recompile for Linux (because your software
is the Linux version), you can skip the configuration details mentioned in the rest
of this section. On the other hand, you may want to know what is happening in the
source code anyway, because you can better understand how Linux works with the Web
server code. If you obtained a generic, untailored version of the NCSA Web server,
you have to configure the software.</P>
<P>Begin by editing the <TT>src/Makefile</TT> file to specify your platform. There
are several variables that you have to check for proper information:
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>AUX_CFLAGS</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Uncomment the entry for Linux (identified by comment lines and symbols, usually).
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>CC</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">The name of the C compiler (usually cc or gcc). </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>EXTRA_LIBS</TT> </TD>
<TD ALIGN="LEFT" VALIGN="TOP">Add any extra libraries that need to be linked in (none are required for Linux).
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT" VALIGN="TOP"><TT>FLAGS<BR>
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP">Add any flags you need for linking (none are required for most Linux linkers).<BR>
</TD>
</TR>
</TABLE>
Finally, look for the <TT>CFLAGS</TT> variable. Some of the values for <TT>CFLAGS</TT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -