📄 1181.html
字号:
User nobody <br>
Group nobody <br>
将 apache 预设为 nobody 这个人及群组!意即所有人皆可以使用 <br>
ServerAdmin frank@mail.uc88.domain <br>
这个是设定你的机器的 httpd 管理员帐号!设成你的帐号吧! <br>
ServerName http://www.uc88.domain/ <br>
这是你主机的名称,先将前面的批注符号拿掉吧! <br>
请设定吧,如果你没有主机名称,就选 localhost 吧! <br>
BindAddress * <br>
这是用来允许你的 WWW 接受虚拟 IP 的机器的项目,例如你的虚拟网域为 <br>
192.168.1.0 ,则可以将 * 改成 192.168.1.0 喔!通常如果要接受虚拟 IP 的话, <br>
直接打 * 就好了!<br>
2. 路径设定:以下的参数在设定每一个网页或者是服务的路径所在!(旧版在 access.conf 中) <br>
<br>
DocumentRoot "/usr/local/apache/htdocs" <br>
上面这个在设定你的主机的主要首页所在,由于我们设定主机名称 <br>
为:http://www.uc88.domain/ ,则当别人在网址列上打入 http://www.uc88.domain/ 时, <br>
系统将会把 /usr/local/apache/htdocs 这个路径下的首页档案传出去! <br>
你也可以自行改变这个路径! <br>
<Directory "/usr/local/apache/htdocs"> <br>
Options Indexes ExecCGI FollowSymLinks MultiViews <br>
AllowOverride None <br>
Order allow,deny <br>
Allow from all <br>
</Directory> <br>
上面显示在主机主网页放置的目录下 WWW 所可以进行的事情! <br>
options 为网页可以进行的工作,可以复选,有以下的几个项目: <br>
ExecCGI:表示可以在这个目录中执行 CGI 程序; <br>
FollowSymLinks:表示可以连结至他处; <br>
MultiViews:表示可以执行动画、音乐等项目 <br>
AllowOverride None 表示任何人都可以读取资料; <br>
至于Allow from all 则表示你的主机接受任何位置来源的连接。 <br>
<IfModule mod_userdir.c> <br>
UserDir public_html <br>
</IfModule> <br>
上面这个选项需要开启,那样你的用户帐号才可以有首页! <br>
而你用户的首页放置在 /home/user/public_html 下,你可以将 <br>
public_html 改成 WWW ,则用户的首页就需要放在 <br>
/home/user/www,若以上面的设定,则以我为例,我的首页需要放在 <br>
/home/frank/public_html 底下才行! <br>
<IfModule mod_dir.c> <br>
DirectoryIndex index.html index.htm index.php <br>
</IfModule> <br>
这个是用来说明首页的文件名称,通常默认值是 index.html,但是有些 <br>
网页编辑器的附档名是 index.htm ,所以你可以加上后面的几个档名, <br>
如此一来,你的首页就可以支持多种档名了!<br>
基本上均使用默认值也就可以了!<br>
3. 开启 PHP 与其它模块:由于我们需要可以支持 php 模块的 apache ,所以需要将这个模块开启喔! <br>
<br>
AddType application/x-httpd-php .php <br>
AddType application/x-httpd-php-source .phps <br>
将这两个模块的批注取消,请注意,这个是 php4 的模块,不要与 php3 模块搞混了! <br>
因为我们是安装 php4 版的幽! <br>
AddHandler cgi-script .cgi <br>
上面这一行的批注也可以拿掉,这样客户端才能使用 CGI 程序!<br>
4. 开启 Apache 状态列:我们可以透过 IE 等浏览器来观看主机的 apache 执行情况,若你需要这个服务,就要将下面的批注取消掉: <br>
<br>
<Location /server-status> <br>
SetHandler server-status <br>
Order deny,allow <br>
Deny from all <br>
Allow from .your_domain.com <br>
</Location> <br>
<Location /server-info> <br>
SetHandler server-info <br>
Order deny,allow <br>
Deny from all <br>
Allow from .your_domain.com <br>
</Location> <br>
将上面的 .your_domain.com 改成你的 DNS , <br>
例如我可以改成 .uc88.domain 喔!这样一来, <br>
只有 uc88.domain 的机器可以看到你的 apache 的执行状态! <br>
如何观看,以我为例,只要在网址列输入 <br>
http://www.uc88.doamin/server-status <br>
http://www.uc88.domain/server-info <br>
则来自 uc88.domain 的用户即可看到我的主机状态!<br>
5. 重新激活:只要下达 /usr/local/apache/bin/apachectl restart 即可执行 httpd 啰!到这里就设定完毕了,执行你的 IE 连上你的网络看看吧!(如果有问题的话,请重新激活 linux 吧!) <br>
<br>
测试 MySQL 及 PHP 套件 <br>
要测试这两个套件前请先确定 MySQL 及 Apache 已经被激活了!OK,来做测试吧!<br>
php 测试: <br>
你可以编辑一个档案,文件名称可以为 test.php ,然后将这个档案放置在 /usr/local/apache/htdocs 当中(就是你的主机的网页所在地喔!) <br>
<br>
[root @tsai /root]# vi /usr/local/apache/htdocs/test.php <br>
<? <br>
phpinfo( ); <br>
?><br>
然后连上你的主机,以我为例,我就要输入 http://www.uc88.domain/test.php 这样就可以看到你的 php 状态啰!也就是你的 php 就可以执行了!<br>
MySQL 测试: <br>
同样的, MySQL 也是编辑一个档案,执行看看可不可以即可: <br>
<br>
[root @tsai /root]# vi /usr/local/apache/htdocs/mysqltest.html <br>
<html> <br>
<body> <br>
<? <br>
$link=mysql_connect('localhost','root'); <br>
mysql_select_db('mysql'); <br>
$str="select * from user;"; <br>
$result=mysql_query($str,$link); <br>
$show=mysql_num_rows($result); <br>
mysql_close($link); <br>
for ($i=0;$i < $show;$i++) <br>
{ <br>
$arr[$i]=mysql_fetch_array($result); <br>
}; <br>
?> <br>
<table align=center border=1> <br>
<tr align=center> <br>
<td>Host</td> <br>
<td>User</td> <br>
<td>Password</td> <br>
</tr> <br>
<?for ($i=0;$i<$show;$i++){?> <br>
<tr> <br>
<td><?echo $arr[$i][Host]?></td> <br>
<td><?echo $arr[$i][User]?></td> <br>
<td><?echo $arr[$i][Password]?></td> <br>
</tr> <br>
<?};?> <br>
</body> <br>
</html> <br>
然后同样的执行 http://www.uc88.domain/mysqltest.html 即可知道你的 mysql 是否可以执行!<br>
<br>
写入第一个个人首页 <br>
如果你的网站支持给用户放置个人网页的话,那你的个人网页在哪里呢?刚刚我们有提到在 httpd.conf 的设定中,有一项关于个人首页的设定,通常如果你不设定 httpd.conf 档案的话,他的默认值都是 public_html ,好了,那要如何设定个人网页呢?假设以 frank 这个帐号为例,我们可以这样进行: <br>
<br>
[frank @frank frank]$ mkdir public_html <br>
[frank @frank frank]$ chmod 755 public_html <br>
[frank @frank frank]$ chmod 755 /home/frank <br>
在你的客户端家目录中建立了一个 public_html 的目录, <br>
并将此目录的权限改成可以让其它人观看,注意喔, apache <br>
预设是 public_html ,但是如果你在 httpd.conf 这个档案中 <br>
改变了目录名称,则必须作适当的修正喔!<br>
然后在你的目录中,亦即 /home/frank/public_html 当中,建立一个档名为 index.html 的 HTML 档案,例如我们刚刚测试的 php 的档案,然后在 IE 的网址列打入 http://你的网站名称/~frank/ 则 apache 会自动将 IE 的讯息传到 /home/frank/public_html 这个目录中,并搜寻文件名为 index.html 或 index.htm 或 index.php 的檔名!所以说, index.html 是 apache 第一个找寻的档名喔!这就是你的首页啦!<br>
然后你就可以经由 php 写你的网页资料,并将之放置在 public_html 这个目录下,就好了!不过用这个方法写网页时,需要注意的是,附檔名是 php3 的档案将不会被执行,所以你要将 php3 改成 php 比较妥当!<br>
<br>
<br>
<br>
就是这个 <br>
[root@tsai /root]# cd /usr/local <br>
[root@tsai local]# tar -zxvf /home/test/apache_1.3.20.tar.gz <br>
[root@tsai local]# tar -zxvf /home/test/mysql-3.23.41.tar.gz <br>
[root@tsai local]# tar -zxvf /home/test/tar -zxvf /test/php-4.0.6.tar.gz(这个看到了没有?)<br>
则在 /usr/local 中会多出三个目录,分别是:apache_1.3.20, mysql-3.23.41, php-4.0.6。<br>
应该是这样<br>
[root@tsai local]# tar -zxvf /home/test/php-4.0.6.tar.gz<br>
<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -