📄 1689.html
字号:
mkdir /usr/local/imap/lib<br>
ln -s /usr/local/include/openssl /usr/include/openssl<br>
<br>
tar -xvzf imap-2002c1.tar.Z<br>
make lrh<br>
cd c-client/<br>
cp *.h /usr/local/imap/include/<br>
cp *.c /usr/local/imap/lib/<br>
cp c-client.a /usr/local/imap/lib/libc-client.a<br>
<br>
<br>
安装PHP<br>
<br>
./configure --with-gettext --with-gd=/usr/local --with-zlib --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --prefix=/usr/local/httpd/php --with-config-file-path=/usr/local/httpd/conf --enable-track-vars --enable-force-cgi-redirect --disable-cgi --with-imap=/usr/local/imap --with-imap-ssl=/usr/local/imap<br>
make<br>
make install<br>
cp -p .libs/libphp4.so /usr/local/httpd/modules<br>
cp -p php.ini-recommended /usr/local/httpd/conf/php.ini<br>
<br>
编辑php.ini<br>
参考以下配置:<br>
QUOTE<br>
<br>
memory_limit = 20M;<br>
file_uploads = On;<br>
upload_max_filesize = 20M;<br>
post_max_size = 20M;<br>
<br>
<br>
编辑httpd.conf<br>
QUOTE<br>
<br>
# Make sure there's only **1** line with this directive:<br>
LoadModule php4_module modules/libphp4.so<br>
<br>
# Add index.php to your DirectoryIndex line:<br>
DirectoryIndex index.html index.php<br>
<br>
AddType application/x-httpd-php php<br>
<br>
# PHP Syntax Coloring (recommended):<br>
AddType application/x-httpd-php-source phps<br>
<br>
<br>
然后重起apache<br>
/etc/init.d/httpd restart<br>
<br>
测试PHP<br>
在/usr/local/httpd/htdocs/目录下建立一个phpinfo.php文件<br>
<br>
phpinfo.php<br>
<?php<br>
phpinfo();<br>
?><br>
<br>
在浏览器输入来查看这个/phpinfo.php,会显示一些PHP的信息。<br>
<br>
优化PHP<br>
PHP只是一个脚本解释引擎,由Zend公司出品,是个免费的东东,Zend同时出了一个免费的Zend Optimizer来优化PHP的解释,根据来自Zend的资料,使用Zend Optimizer之后:<br>
Enhanced server performance – up to 25X increase in server throughput<br>
HOHO,这么好的东东为什么不用,而且用了Zend Optimizer之后,如果把PHP编译(要用到一个收费的东西——Zend Encoder来编译),更加能够提高性能,并且能够保护PHP的代码不被恶意偷取——编译后的东东都是乱七八糟的东西,而且现在还没有看到成功逆向工程的报告。<br>
<br>
从 http://www.zend.com/ 下载最新版本的 Zend Optimizer,Zend Optimizer只提供二进制代码,因此需要注意你的平台。<br>
<br>
tar -xvzf ZendOptimizer-2.1.0a-Linux_glibc21-i386.tar.gz<br>
cd ZendOptimizer-2.1.0a-Linux_glibc21-i386<br>
./install<br>
<br>
回答几个简单问题之后,很容易就装好了。<br>
在安装了Zend Optimizer请确认重起你的Apache。<br>
然后再通过浏览器查看/phpinfo.php, 可以看到在<br>
This program makes use of the Zend Scripting Language Engine:<br>
Zend Engine v1.3.0, Copyright © 1998-2002 Zend Technologies with Zend<br>
下面多了一行<br>
Optimizer v2.1.0, Copyright © 1998-2003, by Zend Technologies<br>
<br>
OK,到现在就可以开始架论坛和主页了。<br>
<br>
终于写到认证部分了,真的是很辛苦。<br>
<br>
Apache的认证,普通都使用passwd文件来进行认证,现在Linux上面Apache+PHP+MySQL用得多,因此xxbin想到要配置一个MySQL的认证。<br>
(其实另外一种选择是采用LDAP认证,国外LDAP应用的稍微多一点,但是也少,很多论坛啊,CMS等都没有LDAP认证的接口,国内LDAP用的就更少了,考虑到这些因数,没有采用LDAP认证)<br>
采用MySQL作为认证的后台,最初的考虑是为了把Apache/ProFTPD/Postfix等认证都统一起来——统一用户认证,再发展下去可以做个统一用户登陆和管理,这不仅仅是现在的一个流行趋势,也将会大大的减轻系统管理员的负担,同时用户也无须记忆多套用户名和密码了。<br>
<br>
从 http://modules.apache.org/ 找到一个支持Apache 2.x/DSO的mod_auth_mysql的模块,但是它的groups的库结构无法满足我们的需求(要时刻注意我们需要和ProFTPD/Postfix集成),无奈只有自己改代码了,改好的代码放在 http://ftp.netbuddy.org/linux/mod_auth_mysql.tar.gz 里面。<br>
<br>
下载、配置、编译、安装<br>
wget http://ftp.netbuddy.org/linux/mod_auth_mysql.tar.gz<br>
tar -xvzf mod_auth_mysql.tar.gz<br>
cd mod_auth_mysql<br>
/usr/local/httpd/bin/apxs -c -D APACHE2 -I/usr/local/mysql/include -L/usr/local/mysql/lib/mysql -lmysqlclient -lm mod_auth_mysql.c<br>
/usr/local/httpd/bin/apxs -i mod_auth_mysql.la<br>
<br>
编辑/usr/local/httpd/conf/httpd.conf文件,加入下面一行:<br>
LoadModule mysql_auth_module modules/mod_auth_mysql.so<br>
<br>
不要忘记重起Apache<br>
<br>
建立用户数据库<br>
用你喜欢的方式联上mysql,建立一个新的数据库。<br>
在这里我们用uls来表示。<br>
<br>
为了安全,还可以在MySQL中建立一个用户来专门读取这个uls数据库,我们将在Apache的配置中使用到这个用户的密码(名文),在这里我们建立了一个用户名为uls_username的用户,密码为uls_password,它只对uls数据有 SELECT/INSERT/UPDATE/DELETE的权限。<br>
<br>
然后在uls这个数据里面建立users表和groups表:<br>
QUOTE<br>
CREATE TABLE users (<br>
username varchar(255) binary NOT NULL default '',<br>
nickname varchar(255) NOT NULL default '',<br>
passwd varchar(255) binary NOT NULL default '',<br>
uid int(11) default NULL,<br>
gid int(11) default NULL,<br>
homedir varchar(255) default NULL,<br>
email varchar(255) default NULL,<br>
shell varchar(255) default NULL,<br>
http_enable tinyint(4) NOT NULL default '0',<br>
ftp_enable tinyint(4) NOT NULL default '0',<br>
mail_enable varchar(4) NOT NULL default '0',<br>
ftp_count int(11) default NULL,<br>
PRIMARY KEY (username)<br>
) TYPE=MyISAM;<br>
<br>
CREATE TABLE groups (<br>
groupname varchar(255) binary NOT NULL default '',<br>
gid int(11) NOT NULL default '0',<br>
members text NOT NULL,<br>
PRIMARY KEY (groupname)<br>
) TYPE=MyISAM;<br>
<br>
<br>
上面的两个表的组成其实与/etc/passwd以及/etc/groups文件及其类似,熟悉Linux/UNIX的朋友一看就知道了。<br>
<br>
注意上面users表里面的passwd为真实的password的MD5摘要,另外groups表里面的members可以由多个username组成,username之间用半角的逗号(,)隔开。<br>
<br>
httpd.conf中的配置<br>
为了保护某个目录,我们需要在httpd.conf中的配置中加入mod_auth_mysql的配置选项:<br>
QUOTE<br>
<br>
<Directory "/usr/local/httpd/htdocs/admin"><br>
AllowOverride AuthConfig<br>
Order allow,deny<br>
Allow from all<br>
<br>
AuthMySQLHost localhost<br>
AuthMySQLDB uls<br>
AuthMySQLUser uls_username<br>
AuthMySQLPassword uls_password<br>
AuthMySQLNameField username<br>
AuthMySQLPasswordField passwd<br>
AuthMySQLCryptedPasswords On<br>
AuthMySQLScrambledPasswords Off<br>
AuthMySQLKeepAlive Off<br>
AuthMySQLAuthoritative Off<br>
AuthMySQLNoPasswd Off<br>
AuthMySQLGroupField groupname<br>
AuthMySQLMembersField members<br>
AuthMySQLUserTable uls_users<br>
AuthMySQLGroupTable uls_groups<br>
AuthMySQLUserCondition http_enable=1<br>
</Directory><br>
<br>
<br>
<br>
上面的选项非常容易懂,在这里就不详细描述了,值得注意的是<br>
AuthMySQLUserCondition http_enable=1<br>
这个选项告诉mod_auth_mysql只有那些http_enable为1的才是合法的用户,这样我们可以非常方便的在users表中控制某个用户是否有http权限了。<br>
<br>
.htaccess的配置<br>
在要保护的/usr/local/httpd/htdocs/admin目录下新建一个 .htaccess 文件(注意文件名前的点)<br>
<br>
.htaccess的配置非常简单,可以使用用户名来认证,比如<br>
AuthName "Site Admin"<br>
AuthType Basic<br>
Require user xxbin<br>
<br>
可以有多个用户,用户名之间用空格隔开<br>
<br>
也可以用groups来进行认证,同时也可以有多个组名,也用空格隔开<br>
<br>
AuthName "Site Admin"<br>
AuthType Basic<br>
Require group admin<br>
<br>
测试认证<br>
分别在users和groups表里面插入一条纪录:<br>
<br>
users:<br>
xxbin $1$Scdnf6uW$0aRetOUCCpAI8/Fd1Xa5b/ 1000 1000 /home/ftp xxbin@netbuddy.org /bin/bash 1 1 1 1<br>
<br>
groups:<br>
admin 1000 xxbin<br>
<br>
然后在浏览器中访问一下你要保护的那个目录,输入你的用户名和密码,看看效果如何!<br>
<br>
PS: 偶们站点的Apache的认证就是用的这个方法。<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 + -