<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Li Yue [学习笔记] &#187; 系统</title>
	<atom:link href="http://www.liyue.org/tech/archives/category/tech/feed" rel="self" type="application/rss+xml" />
	<link>http://www.liyue.org/tech</link>
	<description>技术笔记</description>
	<lastBuildDate>Sun, 18 Jul 2010 02:14:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>系统备份之定期清理日志文件</title>
		<link>http://www.liyue.org/tech/archives/186</link>
		<comments>http://www.liyue.org/tech/archives/186#comments</comments>
		<pubDate>Fri, 06 Nov 2009 09:21:16 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=186</guid>
		<description><![CDATA[一、前言
　　系统备份会定期产生备份文件，日积月累，早期的备份应该删除。设定每周清理一下备份文件，只保留最近7天的数据。可以根据文件的时间检索并删除。适用于系统管理中的数据备份文件和日志文件的管理。
二、SHELL脚本

find /var/web/apache/logs  -type f -ctime +7 -exec rm {} \;

这个脚本会将指定目录及其子目录的所有符合条件的文件删除，没有提示。
三、加入计划任务
将上述命令写入一shell脚本back.sh
赋予可执行权限chmod 755 back.sh
编辑计划任务：
#crontab -u user -e

0 2 * * 0 /home/back.sh

back.sh脚本会在每周日凌晨２点执行。
有关crontab的详细命令参见相关资料，有很多。
这里只简要说明下，计划任务前５位用数字表示依次是：
分：（０——５９）
小时：（１——２３）
日：（１——３１）
月：（１——１２）
星期：（０——６，０为星期日）
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/186/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>数据复活</title>
		<link>http://www.liyue.org/tech/archives/167</link>
		<comments>http://www.liyue.org/tech/archives/167#comments</comments>
		<pubDate>Fri, 10 Apr 2009 04:59:01 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=167</guid>
		<description><![CDATA[　　某个系统管理员一不小心直接用数据库管理工具把一文章表的标题字段类型改了，导致所有文章标题不能正常显示了。上万条的数据有点懵了。之前数据库也没有备份过。试图修复数据库也没有成功。唯一的希望寄托在数据库本身的结构上。
　　由于文章的部分信息在另外一个表中也有所体现，标题信息正在其中。只要将这部分信息重写回表中就可以恢复。两个表是通过ID相关联的。检索出文章对应的标题并写回原表。但是原表文章范围大于另一个表，只要少量信息不存在。能恢复大部分信息就好了。

&#60;?php
$DB_Server = &#34;localhost&#34;;
$DB_Username = &#34;root&#34;;
$DB_Password = &#34;password&#34;;
$DB_DBName = &#34;dbname&#34;;
//$DB_TBLName = &#34;column_article&#34;;
$Connect = @mysql_connect&#40;$DB_Server, $DB_Username, $DB_Password&#41;
or die&#40;&#34;Couldn't connect.&#34;&#41;;
$Db = @mysql_select_db&#40;$DB_DBName, $Connect&#41;
or die&#40;&#34;Couldn't select database.&#34;&#41;;
&#160;
$sql = &#34;Select column_article.title,column_article.articleid,article.title,article.id from column_article,article where column_article.articleid=article.id&#34;;
$ALT_Db = @mysql_select_db&#40;$DB_DBName, $Connect&#41;
or die&#40;&#34;Couldn't select database&#34;&#41;;
&#160;
$result = @mysql_query&#40;$sql,$Connect&#41;
or die&#40;mysql_error&#40;&#41;&#41;;
&#160;
$i = 0;
while&#40;$row = mysql_fetch_row&#40;$result&#41;&#41;
&#123;
$title2=$row&#91;0&#93;;
$title2id=$row&#91;1&#93;;
$upd = @mysql_query&#40;&#34;update article set article.title='$title2' where article.id=$title2id&#34;,$Connect&#41;;
$i++;
&#125;
return &#40;true&#41;;
?&#62;

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/167/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>umask来设定创建文件的默认权限</title>
		<link>http://www.liyue.org/tech/archives/164</link>
		<comments>http://www.liyue.org/tech/archives/164#comments</comments>
		<pubDate>Wed, 25 Feb 2009 03:25:28 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=164</guid>
		<description><![CDATA[　　linux下用户创建文件、文件夹都会有一个默认权限，系统默认文件夹权限是755，文件权限是644这个默认权限是可以设定的，就是通过umask，通过在shell下运行umask命令来看看当前的umask数值是多少，例如文件夹默认权限是755，他的umask数值为022。
　　这个数值表示的是什么意思，又如何来计算出想要的umask值。umask是在下面的配置文件中设定/etc/profile（全局设置），$ [HOME]/.bash_profile或者$ [HOME]/.profile（当前用户的设置，操作系统版本不同，文件名会不同）。在配置文件中加入一行umask 022即可。
　　umask值的计算方法，是通过权限的补码得来。例如文件夹权限755，文件夹的umask各位数值最大可以到7，各位数的补码就是022；而文件权限最大只能到6，因为系统不允许新建文件拥有执行权限。
　　umask值与文件、目录权限对照表：
umask　文件　目录
——————————
0 　　　6 　　　7
1 　　　6　　　 6
2 　　　4 　　　5
3　　　 4 　　　4
4　　　 2　　　 3
5 　　　2　　　 2
6 　　　0　　　 1
7 　　　0　　　 0
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/164/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache日志的cronolog轮循</title>
		<link>http://www.liyue.org/tech/archives/102</link>
		<comments>http://www.liyue.org/tech/archives/102#comments</comments>
		<pubDate>Tue, 09 Dec 2008 15:08:27 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[系统]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=102</guid>
		<description><![CDATA[　　将apache日志按年月日目录分类存放，便于日志分析系统分析。使用cronolog来完成，有windows和linux的版本。Linux安装，解压缩后执行
　　#./configure
　　#./make
　　#./make install
　　在httpd.conf配置使用cronolog，在每个虚拟主机中，加入
　　

CustomLog &#34;&#124;/usr/local/sbin/cronolog /var/logs/%Y/%m/%Y%m%d_access.log&#34; combined
　　ErrorLog &#34;&#124;/usr/local/sbin/cronolog /var/logs/%Y/%m/%Y%m%d_error.log&#34;

　　Windows下cronolog安装，解压缩后，将cronolog.exe文件放到apache安装目录的bin下。配置httpd.conf

TransferLog &#34;&#124;D:/Apache/bin/cronolog.exe D:/Apache/logs/%Y/%m/%d/access.log&#34;
	ErrorLog    &#34;&#124;D:/Apache/bin/cronolog.exe D:/Apache/logs/%Y/%m/%d/access.log&#34;

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/102/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>将mysql检索结果导出EXCEL表</title>
		<link>http://www.liyue.org/tech/archives/94</link>
		<comments>http://www.liyue.org/tech/archives/94#comments</comments>
		<pubDate>Fri, 05 Dec 2008 03:18:19 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=94</guid>
		<description><![CDATA[说明：数据表fawen是文件的标题，正文等信息，数据表pishi是各领导对文件的批示信息，pishi的articleid字段内容与fawen的id相关联。要统计出某位领导的所有批示，导出EXCEL，内容是：文件名称、批示内容、批示时间。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
&#60;?php
$DB_Server = &#34;localhost&#34;;
$DB_Username = &#34;root&#34;;
$DB_Password = &#34;pass&#34;;
$DB_DBName = &#34;office&#34;;
$DB_TBLName = &#34;fawen&#34;;
$Connect = @mysql_connect&#40;$DB_Server, $DB_Username, $DB_Password&#41;
or die&#40;&#34;Couldn't connect.&#34;&#41;;
$Db = @mysql_select_db&#40;$DB_DBName, $Connect&#41;
or die&#40;&#34;Couldn't select database.&#34;&#41;;
$file_type = &#34;vnd.ms-excel&#34;;
$file_ending = &#34;xls&#34;;
header&#40;&#34;Content-Type: application/$file_type&#34;&#41;;
header&#40;&#34;Content-Disposition: attachment; filename=mydowns.$file_ending&#34;&#41;;
header&#40;&#34;Pragma: no-cache&#34;&#41;;
header&#40;&#34;Expires: 0&#34;&#41;;
$now_date = date&#40;'Y-m-d H:i'&#41;;
$title = &#34;格式：第一列为文件名，第二列为领导批示内容，第三列为批示日期&#34;;
$sql = &#34;Select $DB_TBLName.title,pishi.content,pishi.time from $DB_TBLName,pishi where pishi.leadername='领导名称' and $DB_TBLName.id=pishi.articleid&#34;;
$ALT_Db = @mysql_select_db&#40;$DB_DBName, $Connect&#41;
or die&#40;&#34;Couldn't select database&#34;&#41;;
&#160;
&#160;
$result = @mysql_query&#40;$sql,$Connect&#41;
or die&#40;mysql_error&#40;&#41;&#41;;
&#160;
$result2 [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/94/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>数组的应用</title>
		<link>http://www.liyue.org/tech/archives/85</link>
		<comments>http://www.liyue.org/tech/archives/85#comments</comments>
		<pubDate>Mon, 20 Oct 2008 08:44:40 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=85</guid>
		<description><![CDATA[　　对已知数目的查询条件，使用数组定义，然后遍历数组，使用while循环查询符合数组数值条件的记录，并统计。
　　片段：

1
2
3
4
5
6
7
8
9
10
11
12
13
14
		//数组
		$workArray = array&#40;&#34;办公室&#34;, &#34;财务基建&#34;, &#34;人事处&#34;, &#34;老干部处&#34;, &#34;机关党委&#34;,&#34;纪检监察&#34;,&#34;综合处&#34;,&#34;核算处&#34;,&#34;政法处&#34;,&#34;工业处&#34;,&#34;能源处&#34;,&#34;农村处&#34;,&#34;国贸处&#34;,&#34;外经处&#34;,&#34;投资处&#34;,&#34;服务业处&#34;,&#34;人口处&#34;,&#34;社科处&#34;,&#34;普查中心&#34;,&#34;基普办&#34;,&#34;科研所&#34;,&#34;计算中心&#34;,&#34;教育中心&#34;,&#34;记者站&#34;,&#34;印刷厂&#34;&#41;; 
&#160;
			while  &#40;list&#40;$key,$value&#41; = each&#40;$workArray&#41;&#41;  &#123;
				$z--;
				$sql5=&#34;select count(id) as id from art where author='$value' and createdate&#62;='$starttime' and createdate &#60;='$endtime'&#34;;
				$r5= $DB_web-&#62;query_first&#40;$sql5&#41;;
&#160;
				print &#34;&#60;tr bgcolor='#DDDDDD'&#62;&#34;;
				print &#34;&#60;td height='20'&#62;&#38;nbsp;$value&#60;/td&#62;&#34;;
				print &#34;&#60;td height='20'&#62;&#38;nbsp;$r5[id]&#60;/td&#62;&#34;;
　　　　　　　　print &#34;&#60;/tr&#62;&#34;;
&#160;
			&#125;

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/85/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP无组件上传文件问题</title>
		<link>http://www.liyue.org/tech/archives/82</link>
		<comments>http://www.liyue.org/tech/archives/82#comments</comments>
		<pubDate>Thu, 25 Sep 2008 02:36:53 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[asp]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=82</guid>
		<description><![CDATA[　　背景：在使用ASP的BLOG程序上传文件时候，报错，发现只能上传200K以下文件。运行环境是windows2003/IIS6，ASP程序是无组件上传模块。
　　错误信息：Request 对象 错误 &#8216;ASP 0104 : 80004005&#8242;
　　参考网址：微软知识库http://support.microsoft.com/kb/327659/
　　解决方法：修改默认允许的最大请求。首先停止IIS服务。打开 %systemroot%System32Inetsrv 中的 metabase.XML文件，查找AspMaxRequestEntityAllowed，修改默认的数值200K（204800），如50M为51200000。
　　建议：采用ASP上传组件替代无组件，并将上面数值还原。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/82/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache2.2.9/tomcat5.5.16整合</title>
		<link>http://www.liyue.org/tech/archives/62</link>
		<comments>http://www.liyue.org/tech/archives/62#comments</comments>
		<pubDate>Wed, 24 Sep 2008 04:06:13 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=62</guid>
		<description><![CDATA[　　1、Apache2.2.9的安装只用了一个配置命令：
　　　　./configure &#8211;prefix=/usr/local/apache &#8211;enable-rewrite=shared
　　2、Tomcat5.5.16二进制方式，解压。
　　3、安装jakarta-tomcat-connectors-jk2-src-current.tar.gz
　　　　下载地址：http://archive.apache.org/dist/jakarta/tomcat-connectors/jk2/source/
　　　　解压后，进入到jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2目录
　　　　执行./configure &#8211;with-apxs2=/usr/local/apache/bin/apxs
　　　　　　make
　　　　拷贝mod_jk2.so文件，到apache的modules目录。
　　　　cp jakarta-tomcat-connectors-jk2-2.0.4-src/jk/build/jk2/apache2/mod_jk2.so
　　　　　　/usr/local/apache/modules/
　　4、配置apache配置文件：
　　　　编辑httpd.conf
　　　　Listen 10.10.10.197:80下面添加一行，加载mod_jk2.so.
　　　　LoadModule jk2_module modules/mod_jk2.so
　　　　找到下面一行，并且去掉注释符号#，加载虚拟主机配置文件
　　　　Include conf/extra/httpd-vhosts.conf
　　5、配置虚拟主机：

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
&#60;VirtualHost *&#62;
    ServerAdmin web@domain.com
    DocumentRoot &#34;/usr/local/tomcat/webapps&#34;
#需要转给tomcat处理的文件名，如*.jsp，这里是*.*所有文件处理转给tomcat 
    &#60;Location ~ &#34;/*.*&#34;&#62;
            JkUriSet worker ajp13:localhost:8009
        &#60;/Location&#62;
    ServerName search.domain.com
  [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/62/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LAMP的部署经历</title>
		<link>http://www.liyue.org/tech/archives/35</link>
		<comments>http://www.liyue.org/tech/archives/35#comments</comments>
		<pubDate>Sun, 10 Aug 2008 01:26:54 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[系统]]></category>
		<category><![CDATA[lamp]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=35</guid>
		<description><![CDATA[　　此次安装的版本比较低，适用于某个老系统的环境要求。费了一些周折，网络上提供的资料准确性有限，很杂乱。需要自己的实践和研究总结一些方法。
　　环境：Redhat AS5,Apache1.3.9,PHP4.1.2,Mysql4.1,ZendOptimizer-2.5.7
　　其他软件：zlib-1.2.3.tar.gz（后面会提及）
一、MySQL数据库
1、第一次用二进制方式安装，直接解压，初始化数据库出错，启动也失败过，后来采用源码安装包安装，避免麻烦。
源码安装：

1
2
3
4
5
6
7
8
9
10
11
12
groupadd mysql  /*创建mysql用户组*/
useradd -g mysql mysql /*创建用户*/
tar zxvf mysql-4.1.tar.gz    /*解压缩*/
cd mysql-4.1
./configure --prefix=/usr/local/mysql /*指定mysql安装路径*/
make /*时间会比较长*/
make install /*安装完毕*/
cp support-files/my-large.cnf /etc/my.cnf    /*复制配置文件改名为my.cnf，如果提示覆盖按Y确定*/
cd /usr/local/mysql
bin/mysql_install_db --user=mysql    /*必须以mysql用户初始化数据库*/
chown -R mysql:mysql /usr/local/mysql  /*更改mysql目录所有者权限，否则会导致启动失败*/
bin/mysqld_safe --user=mysql &#38;amp;    /*用mysql用户启动服务，只有不提示end，就成功了*/

2、修改mysql密码：
#mysqladmin -u root -p password &#8216;mypasswd&#8217;
输入这个命令后，需要输入root的原密码，然后root的密码将改为mypasswd。
mysql4以上版本会出现客户端连接不上的情况。需要再做如下操作更新：
#mysql -u root -p 　/*输入刚才更改的密码登陆*/
执行下面的语句：
set password for root@&#8221;localhost&#8221;=old_password(&#8216;mypasswd&#8216;);
3、更改mysql默认最大连接数
mysql默认最大连接数是100,在实际应用中，不够。
修改mysqld_safe（一种不需要编译mysql就可以实现的方法）
编辑mysqld_safe启动脚本，找到mysqld启动的那两行，在后面加上参数 ：
-O max_connections=1000
然后关闭mysql重启它，用
mysqladmin -uroot -p variables
输入root数据库账号的密码后可看到变量信息。
&#124; max_connections &#124; 1000 &#124;
即新改动已经生效。
二、安装apache
　　tar -zxvf apache_1.3.9.tar
　　cd apache_1.3.9
　　./configure &#8211;prefix=/usr/local/apache &#8211;enable-module=so  /*指定安装路径，激活动态模式,必需激活mod_so*/
　　make
　　make [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/35/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux系统的hosts.allow和hosts.deny</title>
		<link>http://www.liyue.org/tech/archives/33</link>
		<comments>http://www.liyue.org/tech/archives/33#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:25:26 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[安全]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=33</guid>
		<description><![CDATA[　　奥运了，各单位对信息安全特别重视，要求加强服务器安全，所有服务器统一修改密码，关闭WEB服务器除了80端口的所有端口，关闭远程控制SSH。统一使用单位的VPN服务来管理。关闭外部的所有链接，除了VPN服务器的，这样，就必须通过VPN来远程控制服务器，VPN只有管理员才有账户登录权限。
　　限制访问主机的服务。可以限制，只能是指定的IP才能访问本机的某个服务。
　　编辑/etc/hosts.allow
　　加入下面的一行，允许10.0.0.1通过ssh服务链接服务器：
　　sshd:10.0.0.1
　　编辑/etc/hosts.deny，加入：
　　ALL: ALL@ALL, PARANOID
　　拒绝其他所有的服务请求。
　　通过上述设置后，先通过登录VPN系统认证后，再使用SSH登录服务器就可以了。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/33/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>通过VNC安装Oracle</title>
		<link>http://www.liyue.org/tech/archives/31</link>
		<comments>http://www.liyue.org/tech/archives/31#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:18:05 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[vnc]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=31</guid>
		<description><![CDATA[运行vncserver，提示输入密码（远程登录密码），生成端口号：1。
打开防火墙，添加vnc端口。可以从netstat看出端口号。如5801
下载VNC客户端，登录窗口，服务器输入IP:1
输入密码。
或者通过浏览器访问：ip:5801
为ORACLE安装图像界面做准备，以ROOT运行xhost +　提示未授权。执行export DISPLAY=客户端IP:1.0
再次执行xhost +成功。在vnc窗口，以oracle用户执行./runInstaller ，成功出现中文图形安装界面。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/31/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SELinux对Apache限制和小插曲</title>
		<link>http://www.liyue.org/tech/archives/29</link>
		<comments>http://www.liyue.org/tech/archives/29#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:16:51 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=29</guid>
		<description><![CDATA[
　　CentOS4.6自带APACHE不能更改默认根目录，虚拟主机指向其他目录不认。是SELinux激活的原因，关闭他：
# vi /etc/selinux/config
 # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing &#8211; SELinux security policy is enforced.
#       permissive &#8211; SELinux prints warnings instead of enforcing.
#       disabled &#8211; SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted &#8211; Only targeted network [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/29/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>优化WEB服务器防止攻击</title>
		<link>http://www.liyue.org/tech/archives/27</link>
		<comments>http://www.liyue.org/tech/archives/27#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:14:51 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[安全]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=27</guid>
		<description><![CDATA[　前些天学校网站变得很慢，进行了一些调整来缓解。先把上面的动态程序移走，只保留纯html静态网页。只运行apache，问题没有解决。netstat查看有不少SYN_RECV、TIME_WAIT、FIN_WAIT_1等状态存在的链接。查看资料，可能是SYN Flood攻击.　　作如下配置来缓解：
1、增加未完成连接队列（q0)的最大长度。
echo 2048&#62;/proc/sys/net/ipv4/tcp_max_syn_backlog
2、启动SYN_cookie。
echo 1&#62;/proc/sys/net/ipv4/tcp_syncookies
这些是被动的方法，治标不治本。
把上述命令加入启动脚本
/etc/rc.d/boot.local（SUSE LINUX）/etc/rc.local(redhat linux)
3、iptables的设置，引用自CU
防止同步包洪水（Sync Flood）
# iptables -A FORWARD -p tcp &#8211;syn -m limit &#8211;limit 1/s -j ACCEPT
也有人写作
#iptables -A INPUT -p tcp &#8211;syn -m limit &#8211;limit 1/s -j ACCEPT
&#8211;limit 1/s 限制syn并发数每秒1次，可以根据自己的需要修改
防止各种端口扫描
# iptables -A FORWARD -p tcp &#8211;tcp-flags SYN,ACK,FIN,RST RST -m limit &#8211;limit 1/s -j ACCEPT
Ping洪水攻击（Ping of Death）
# iptables -A FORWARD -p icmp &#8211;icmp-type echo-request [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/27/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql最大连接数</title>
		<link>http://www.liyue.org/tech/archives/25</link>
		<comments>http://www.liyue.org/tech/archives/25#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:11:22 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=25</guid>
		<description><![CDATA[　　在linux下修改mysql最大连接数，网上说修改/etc/my.cnf文件。在[mysqld]段加入 max_connections =1000一行参数。结果导致启动失败。后来改成set-variable   = max_connections =1000成功。
　　还有将/etc/my.cnf权限改成644。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/25/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为CMS系统制作dreamweaver模板插件</title>
		<link>http://www.liyue.org/tech/archives/17</link>
		<comments>http://www.liyue.org/tech/archives/17#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:06:23 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[dreamweaver]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=17</guid>
		<description><![CDATA[　　CMS系统的在线模板编辑功能很弱，处理不好还会过滤掉有用的代码。一般来说，很少有人使用在线的模板编辑器，而是使用dreamweaver将模板做好，再将模板文件传到系统上去，或者是将源代码粘贴到模板编辑器中。在模板的可编辑区中，需要插入CMS系统相应的标记代码，便于系统识别执行。每个产品定义的标记方式不尽相同。　　Velocity模板引擎中，可以定义为${getTag-123}，这个就是标记。数字123是可编辑单元的编号，由CMS系统自动生成。在模板中经常要插入这样的标记，总是记不住怎么写这个标记，复制粘贴太不方便。在DREAMWEAVER中做个插件，输入编号插入上面的标记岂不方便。
　　可以参考dreamweaver自带的插件作为模板。
　　１、需要制作一个.mxi的xml类型文件。








Velocity模板插件，用于在模板中插入标记！
]]&#62;



作者主页：http://www.liyue.org
]]&#62;



]]&#62;
























２、按上面文件描述这个插件有两个按钮，标记数字编号和当前位置。下面就制作这两个按钮的执行文件。
　　（１）gettagname.htm:












标记数字编号:







　　（２）这个gettagname.htm调用了一个js脚本文件gettagname.js来处理用户的输入：

// Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved
//&#8212;&#8212;&#8212;&#8212;&#8212; GLOBAL VARIABLES &#8212;&#8212;&#8212;&#8212;&#8212;
var helpDoc = MM.HELP_objAnchor;
//&#8212;&#8212;&#8212;&#8212;&#8212; LOCAL FUNCTIONS &#8212;&#8212;&#8212;&#8212;&#8212;
function initUI() {
var curDOM = dw.getDocumentDOM(&#8216;document&#8217;);
if (curDOM &#038;&#038; (curDOM.getSelectedNode().nodeType == Node.TEXT_NODE)) {
var curSel = dw.getSelection();
document.theform.anchorname.value = curDOM.documentElement.outerHTML.slice(curSel[0],curSel[1]);
}
document.theform.anchorname.focus();
}
function errorCheck()
{
var theString = document.forms[0].anchorname.value;
if (theString.search(/W/) != -1)
{
alert(MM.MSG_InvalidName);
document.forms[0].anchorname.value = theString.replace(/W/g,&#8221;")
}
}
//&#8212;&#8212;&#8212;&#8212;&#8212; API FUNCTIONS &#8212;&#8212;&#8212;&#8212;&#8212;
function isDOMRequired() {
// Return false, indicating that this object [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/17/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rsync镜像的另一种方法使用ssh-keygen</title>
		<link>http://www.liyue.org/tech/archives/15</link>
		<comments>http://www.liyue.org/tech/archives/15#comments</comments>
		<pubDate>Thu, 07 Aug 2008 13:49:48 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=15</guid>
		<description><![CDATA[安装部署说明
1. 简介
1.1 目的
本文档主要介绍页面防篡改系统的安装部署
1.2 范围
应用范围包括有：
项目部
使用该系统的客户
1.3 概述
页面防篡改系统是由一台制作服务器和一台或者两台以上发布服务器组成。制作服务器作为数据源，发布服务器作为数据同步的对象。数据定期从制作服务器同步到发布服务器，一旦发布服务器的数据被修改，会在一两分钟（时间可以自由设置）之内被修复。页面防篡改系统会定时比较发布服务器的数据是否和制作服务器的数据一致。
2. 参考资料
标题
版本
作者
rsync同步镜像配置
1.0
lee
 
3. 系统环境
3.1 硬件要求
· WEB服务器：
Ø 最低配置：P4 2.0 CPU、512M内存、2GM剩余硬盘空
 
· 制作服务器端
Ø 最低配置：P4 2.0 CPU、512M内存、2GM剩余硬盘空
3.2 软件环境
· WEB服务器：
Ø RedHat Linux 7.3以上/RedHat.Enterprise.Server.3.AS
· 制作服务器：
Ø RedHat Linux 7.3以上/RedHat.Enterprise.Server.3.AS
 
4. 安装部署
4.1 准备过程
至少需要两台服务器，一台为制作服务器，安装BX系统，用来制作网站；一台为发布服务器，用来发布生成后的网站。
我们采用rsync服务来实现。制作服务器需要运行rsync服务，利用rsync服务同步到发布服务器。
4.2 SSH加密通道配置
1）利用rsync服务，需要通过ssh加密通道。利用ssh-kengen生成ssh密匙。
在制作服务器上运行如下命令：
ssh-keygen -t dsa
命令提示你将生成的密匙保存在哪里，输入一个路径/home/id_dsa
直接回车确认即可。于是，在/home下生成id_dsa和id_dsa.pub两个文件。
2）在制作服务器/home分区下，创建.ssh文件夹。
mkdir ~/.ssh (这个是隐藏文件夹)
将生成的两个文件复制到.ssh文件夹中。
3）在发布服务器上，同样在/home分区下，创建文件夹.ssh，在下面创建authorized_keys文本文件，将前面生成的id_dsa.pub文件里面的字符内容，复制粘贴到authorized_keys文件中。
 
4.3 测试同步配置
在制作服务器上运行如下命令来测试同步是否成功。
/usr/bin/rsync -av -e ssh &#8211;delete /var/web/www/html/cms[技术部1] 10.112.190.162[技术部2] :/var/web/www/html[技术部3]
 
注意：第一次建立SSH连接时会提示你连接确认。提示信息如下：
The authenticity of host &#8216;10.238.163.15 (10.238.163.15)&#8217; can&#8217;t be established.
RSA key fingerprint is a3:ad:da:55:86:27:e8:66:e8:0d:b5:a1:1d:b2:9b:66.
Are you sure you [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/15/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>apache授权访问</title>
		<link>http://www.liyue.org/tech/archives/13</link>
		<comments>http://www.liyue.org/tech/archives/13#comments</comments>
		<pubDate>Thu, 07 Aug 2008 13:43:19 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=13</guid>
		<description><![CDATA[背景：
 我们公司的web服务器是linux+apache,自己有一个内部交流的OA放在web服务器上，同时还有一些外部的网站。其中内部的OA除了公司的人其他人是不允许访问的。仅依靠OA系统本身的登陆验证不够。需要对整个OA程序从文件角度验证。这就利用apache身份验证。
 采用“用户名+密码”以文本文件为存储方式的认证。
方法：
 一、修改apache的配置文件。
  
      Options +Indexes FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
  
  这是发布目录的根目录。需要对根目录下的bbs目录验证。增加一段：
  
      Options +Indexes FollowSymLinks
      AllowOverride authconfig
      Order allow,deny
      Allow from all
  
 二、在限制访问的目录bbs下，建立一个文件.htaccess 内容如下：
  authname &#8220;beijing OA&#8221;
  authtype basic
  authuserfile /etc/.passwd
  require valid-user
 三、用apache自带的htpasswd,生成包含用户名和密码的文本文件。每行内容格式为“用户名：
密码”。
  # htpasswd -bc /etc/.passwd bj password (创建新的密码文件并添加用户)
  增加用户：
  # htpasswd -b /etc/.passwd admin password (在密码文件中添加用户)
  删除用户：
  # htpasswd -D /etc/.passwd bj

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/13/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rsync同步镜像配置</title>
		<link>http://www.liyue.org/tech/archives/11</link>
		<comments>http://www.liyue.org/tech/archives/11#comments</comments>
		<pubDate>Thu, 07 Aug 2008 13:41:35 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=11</guid>
		<description><![CDATA[需要两台服务器，一台为制作服务器，安装CMS系统，用来制作网站；一台为发布服务器，用来发布生成后的静态网站。
我们采用rsync服务，来实现。原理是发布服务器从制作服务器端镜象数据。制作服务器需要安装rsync服务，充当rsync服务器，而发布服务器充当rsync客户端角色。
 一、.在rsync服务器端安装配置rsync服务，查看是否安装了rsync，
rpm -qa&#124;grep rsync
以RedHat linux AS3为例，rsync-2.5.6-20
1. 启动rsync
rsync -daemon
或者/etc/init.d/xinetd start (stop/restart)
如果想要它在每次开机时自动启动，在命令行执行setup命令，进入system services（系统服务），找到rsync服务，选中。重起系统即可。
2. 配置rsync,打开/etc/rsyncd.conf
如果没有此文件则创建它。
文件内容如下书写：
[www] （这是要镜象的模块名字，可以随意起）
uid=0
gid=0
path = /var/web/htdocs/sites （这个是被镜象的文件夹路径）
ignore errors
read only = true
list = false
hosts allow = 10.30.0.59 （这个地址是发布服务器的地址，意为允许此地址对服务器镜象）
hosts deny = 0.0.0.0/32
（如果你还有其他的文件需要镜象，那么请复制上面这段，更改模块名字和path地址） 
二、配置rsync客户端，就是发布服务器。
 １、首先你应该先测试一下，能否镜象。
在命令行执行：
rsync -tvzrp &#8211;progress 10.30.0.57::www /var/web/www
　　　　　　　　　　～～～～～ &#8212;&#8212;-　＝＝＝＝＝＝＝
　　　　　　　　rsync服务器ip 模块名　镜象到的地址
成功的话，可以看到镜象文件时的过程。
 ２、一下步就是让rsync客户端自动执行镜象命令。以便保持同步。
这就利用linux 的crontab服务，定时执行命令。（类似windows的计划任务）
１）将镜象的命令制作一个脚本，在/home 下，新建一个文件sync
将上面的命令写入文件。然后，更改此文件权限：chmod u+x　sync
2）让linux自动执行命令：
执行：crontab -e 命令
键入：*/5 * * * * /home/sync
意思就是每隔5分钟执行/home/sync脚本。
应该让系统每次开机都运行crontab服务。同样运行setup，在system services里面，找到crontab服务，选中它。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/11/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>suse、jdk、tomcat</title>
		<link>http://www.liyue.org/tech/archives/9</link>
		<comments>http://www.liyue.org/tech/archives/9#comments</comments>
		<pubDate>Thu, 07 Aug 2008 13:39:28 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[suse]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=9</guid>
		<description><![CDATA[将jdk-1_5_0_06-linux-i586.bin文件放到/usr/local下，执行bin文件，生成
jdk1.5.0_06文件夹。
修改配置文件，增加环境变量。
编辑/etc/profile，增加：
PATH=$PATH:/usr/local/jdk1.5.0_06/bin:/usr/local/jdk1.5.0_06/jre/bin:/usr/lo
cal/tomcat/bin:.
export PATH
JAVA_HOME=/usr/local/jdk1.5.0_06
export JAVA_HOME
CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME
CLASSPATH=./:/usr/local/jdk1.5.0_06/lib:/usr/local/jdk1.5.0_06/jre/lib:$CATA
LINA_HOME/common/lib/servlet.jar
export CLASSPATH
将tomcat压缩包解压到/usr/local下。文件夹名为tomcat。
执行bin下的startup.sh。成功。
将WEB应用部署在webapps以为的路径下，并修改conf/server.xml文件，在&#60;host&#62;段里
面，增加
&#60;Context path=&#8221;/web&#8221; docBase=&#8221;/opt/app/web&#8221;/&#62;
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>suse上的oracle</title>
		<link>http://www.liyue.org/tech/archives/7</link>
		<comments>http://www.liyue.org/tech/archives/7#comments</comments>
		<pubDate>Thu, 07 Aug 2008 13:38:20 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=7</guid>
		<description><![CDATA[Suse10已经对oracle10g有很好的支持，包括账户的建立，参数环境的配置，只需做很少的工作就能够顺利部署oracle数据库。系统已经添加了oracle账户和oinstall组。设置oracle账户密码passwd oracle。
修改安装文件和数据库目录权限：
Chown -R oracle.install /opt/oracle
Chown -R oracle.install /home/database (安装文件目录)
配置文件脚本/etc/profile.d/oracle.sh，里面已经设置好了参数信息。
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
# Set your ORACLE environment variable here
# ORACLE_HOME &#8211; Used here and in /etc/init.d/oracle (ora_environment())
# ORACLE_SID &#8211; Your Oracle System Identifier
#
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2/db_1
ORACLE_SID=orcl
export ORACLE_BASE ORACLE_HOME ORACLE_SID
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
运行runInstaller，linux版本检测没有通过，加参数忽略检测。
runInstaller -ignoreSysPrereqs
安装成功后，我们使用em进行管理。启动em
emctl start dbconsole
提示信息：
TZ set to Asia/Shanghai
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://linux-eyh7.site:1158/em/console/aboutApplication
Starting Oracle Enterprise [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
