⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch51.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 4 页
字号:


</Directory>



</FONT></PRE>



	<P>and anything between the beginning and ending delimiters (<TT>&lt;Directory&gt;</TT>



	and <TT>&lt;/Directory&gt;,</TT> respectively) are directives. It's not quite that



	easy, because there are several variations that can exist in the file. The best way



	to customize the <TT>access.conf-dist</TT> file is to follow these steps for a typical



	Web server installation:







	<DL>



	<DD><B>1.</B> Locate the Options directive and remove the Indexes option. This prevents



	users from browsing the <TT>httpd</TT> directory. Valid Options entries are discussed



	shortly.<BR>



	<BR>



	<B>2.</B> Locate the first Directory directive and check the path to the <TT>cgi-bin</TT>



	directory. The default path is <TT>/usr/local/etc/httpd/cgi-bin</TT>.<BR>



	<BR>



	<B>3.</B> Find the <TT>AllowOverride</TT> variable and set it to <TT>None</TT> (this



	prevents others from changing the settings). The default is <TT>All</TT>. Valid values



	for the <TT>AllowOverride</TT> variable are discussed shortly.<BR>



	<BR>



	<B>4. </B>Find the Limit directive and set it to whichever value you want.



	</DL>







	<P>The Limit directive controls access to your server. The following are valid values



	for the Limit directive: 



	<TABLE BORDER="0">



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>allow</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Allows specific host names following the <TT>allow</TT> keyword to access the service.



					</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>deny</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Denies specific host names following the <TT>deny</TT> keyword from accessing the



			service. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>order</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Specifies the order in which <TT>allow</TT> and <TT>deny</TT> directives are evaluated



			(usually set to <TT>deny,allow</TT> but can also be <TT>allow,deny</TT>). </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>require<BR>



			</TT></TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Requires authentication through a user file specified in the <TT>AuthUserFile</TT>



			entry.<BR>



					</TD>



	</TR>



	</TABLE>



The Options directive can have several entries, all of which have a different purpose.



	The default entry for Options is<FONT COLOR="#0066FF"></FONT>



	<PRE><FONT COLOR="#0066FF">Options Indexes FollowSymLinks



</FONT></PRE>



	<P>You removed the Indexes entry from the Options directive in the first step of



	the preceding customization procedure. These entries all apply to the directory the



	<TT>Options</TT> field appears in. The valid entries for the Options directive are



	



	<TABLE BORDER="0">



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>All</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">All features enabled. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>ExecCGI</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>cgi</TT> scripts can be executed from this directory. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>FollowSymLinks</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Allows <TT>httpd</TT> to follow symbolic links. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Includes</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Include</TT> files for the server are enabled. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IncludesNoExec</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Include</TT> files for the server are enabled but the <TT>exec</TT> option is



			disabled. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Indexes</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Enables users to retrieve server-generated indexes (doesn't affect precompiled indexes).



					</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>None</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">No features enabled. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>SymLinksIfOwnerMatch<BR>



			</TT></TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Follows symbolic links only if the user ID of the symbolic link matches the user



			ID of the file.<BR>



					</TD>



	</TR>



	</TABLE>



The <TT>AllowOverride</TT> variable is set to <TT>All</TT> by default, and this should



	be changed. There are several valid values for <TT>AllowOverride</TT>, but the recommended



	setting for most Linux systems is <TT>None</TT>. These are the valid values for <TT>AllowOverride</TT>:



	



	<TABLE BORDER="0">



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>All</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Access controlled by a configuration file in each directory. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>AuthConfig</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Enables some authentication routines. Valid values: <TT>AuthName</TT> (sets authorization



			name of directory); <TT>AuthType</TT> (sets authorization type of the directory,



			although there is only one legal value: <TT>Basic</TT>); <TT>AuthUserFile</TT> (specifies



			a file containing user names and passwords); and <TT>AuthGroupFile</TT> (specifies



			a file containing group names). </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>FileInfo</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Enables <TT>AddType</TT> and <TT>AddEncoding</TT> directives. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Limit</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Enables <TT>Limit</TT> directive. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>None</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">No access files allowed. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Options<BR>



			</TT></TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Enables <TT>Options</TT> directive.<BR>



					</TD>



	</TR>



	</TABLE>



After all that, the configuration files should be properly set. While the syntax



	is a little confusing, reading the default values shows you the proper format to



	use when changing entries. Next, you can start the Web server software.



	<CENTER>



	<H4><A NAME="Heading8<FONT COLOR="#000077">Starting the Web Software</FONT></H4>



</CENTER>



	<P>With the configuration complete, it's time to try out the Web server software.



	In the configuration files, you made a decision as to whether the Web software will



	run as a daemon (standalone) or will start from <TT>inetd</TT>. The startup procedure



	is a little different for each method (as you would expect), but both startup procedures



	can use one of the following three options on the command line: 



	<TABLE BORDER="0">



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="30" ALIGN="LEFT" VALIGN="TOP"><TT>-d</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">The absolute path to the root directory of the server files (used only if the default



			location is not valid). </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="30" ALIGN="LEFT" VALIGN="TOP"><TT>-f</TT> </TD>



		<TD ALIGN="LEFT" VALIGN="TOP">The configuration file to read if not the default value of <TT>httpd.conf</TT>. </TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="30" ALIGN="LEFT" VALIGN="TOP"><TT>-v<BR>



			</TT></TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Displays the version number.<BR>



					</TD>



	</TR>



	</TABLE>



If you are using <TT>inetd</TT> to start your Web server software, you need to make



	a change to the <TT>/etc/ services</TT> file to permit the Web software. Add a line



	similar to this to the <TT>/etc/services</TT> file:<FONT COLOR="#0066FF"></FONT>



	<PRE><FONT COLOR="#0066FF">http    port/tcp



</FONT></PRE>



	<P>Here, port is the port number used by your Web server software (usually 80).</P>



	<P>Next, modify the <TT>/etc/inetd.conf</TT> file to include the startup commands



	for the Web server where the last entry is the path to the <TT>httpd</TT> binary:<FONT



	COLOR="#0066FF"></FONT>



	<PRE><FONT COLOR="#0066FF">httpd stream tcp nowait nobody /usr/web/httpd



</FONT></PRE>



	<P>Once this is done, restart <TT>inetd</TT> by killing and restarting the <TT>inetd</TT>



	process or by rebooting your system. The service should be available through whatever



	port you specified in <TT>/etc/services</TT>.</P>



	<P>If you are running the Web server software as a daemon, you can start it at any



	time from the command line with the following command:<FONT COLOR="#0066FF"></FONT>



	<PRE><FONT COLOR="#0066FF">httpd &amp;



</FONT></PRE>



	<P>Even better, add the startup commands to the proper <TT>rc</TT> startup files.



	The entry usually looks like this:<FONT COLOR="#0066FF"></FONT>



	<PRE><FONT COLOR="#0066FF"># start httpd



if [ -x /usr/web/httpd ]



then



 /usr/web/httpd



fi



</FONT></PRE>



	<P>substituting the proper paths for the <TT>httpd</TT> binary, of course. Rebooting



	your machine should start the Web server software on the default port number.</P>



	<P>To test the Web server software, use any Web browser and type the URL field<FONT



	COLOR="#0066FF"></FONT>



	<PRE><FONT COLOR="#0066FF">http://machinename



</FONT></PRE>



	<P>where machinename is the name of your Web server. If you see the contents of the



	root Web directory or the <TT>index.html</TT> file, all is well. Otherwise, check



	the log files and configuration files for clues as to the problem.</P>



	<P>If you haven't installed a Web browser yet, you can still check to see if the



	Web server is running by using <TT>telnet</TT>. Issue a command like this, substituting



	the name of your server (and your Web port number if different than 80):<FONT COLOR="#0066FF"></FONT>



	<PRE><FONT COLOR="#0066FF">telnet www.wizard.tpci.com 80



</FONT></PRE>



	<P>You should get a message similar to this if the Web server is responding properly:<FONT



	COLOR="#0066FF"></FONT>



	<PRE><FONT COLOR="#0066FF">Connected to wizard.tpci.com



Escape character is `^]'.



HEAD/HTTP/1.0



HTTP/1.0 200 OK



</FONT></PRE>



	<P>You'll also see some more lines showing details about the date and content. You



	may not be able to access anything, but this shows that the Web software is responding



	properly.



	<CENTER>



	<H3><A NAME="Heading9<FONT COLOR="#000077">Setting Up Your Web Site</FONT></H3>



</CENTER>



	<P>Having a server with nothing for content is useless, so you need to set up the



	information you will share through your Web system. This begins with Uniform Resource



	Locators (URLs), which are addresses to file locations. Anyone using your service



	only has to know the URL. You don't need to have anything fancy. If you don't have



	a special home page, anyone connecting to your system will get the contents of the



	Web root directory's <TT>index.html</TT> file, or failing that, a directory listing



	of the Web root directory. That's pretty boring, though, and most users want fancy



	home pages. To write a home page, you need to use HTML (HyperText Markup Language).</P>



	<P>A home page is like a main menu. Many users may not ever see it because they can



	enter into any of the subdirectories on your system, or obtain files from another



	Web system through a hyperlink, without ever seeing your home page. However, many



	users want to start at the top, and that's where your home page comes in. A home



	page file is usually called <TT>index.html</TT>. It is usually at the top of your



	Web source directories.</P>



	<P>Writing an HTML document is not too difficult. The language uses a set of tags



	to indicate how the text is to be treated (such as headlines, body text, figures,



	and so on). The tricky part of HTML is getting the tags in the right place, without



	extra material on a line. HTML is rather strict about its syntax, so errors must



	be avoided to prevent problems.</P>



	<P>In the early days of the Web, all documents were written with simple text editors.



	As the Web expanded, dedicated Web editors that understand HTML and the use of tags



	began to appear. Their popularity has driven developers to produce dozens of editors,



	filters, and utilities--all aimed at making a Web documenter's life easier (as well



	as to ensure that the HTML language is properly used). There are HTML editors for



	many operating systems.



	<CENTER>



	<H4><A NAME="Heading10<FONT COLOR="#000077">HTML Authoring Tools</FONT></H4>



</CENTER>



	<P>You can write HTML documents in many ways: You can use an ASCII editor, a word



	processor, or a dedicated HTML tool. The choice of which method you use depends on



	personal preference and your confidence in HTML coding, as well as which tools you



	can easily obtain. Because many HTML-specific tools have checking routines or filters



	to verify that your documents are correctly laid out and formatted, they can be appealing.



	They also tend to be more friendly than non-HTML editors. On the other hand, if you



	are a veteran programmer or writer, you may want to stick with your favorite editor

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -