<?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>LinuxByte &#187; 服务器应用</title>
	<atom:link href="http://www.linuxbyte.org/category/server/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxbyte.org</link>
	<description>一个Linux Blog</description>
	<lastBuildDate>Thu, 26 Jan 2012 08:13:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>网吧Linux 网关设置记录补充</title>
		<link>http://www.linuxbyte.org/wang-ba-linux-wang-guan-she-zhi-ji-lu-bu-chong.html</link>
		<comments>http://www.linuxbyte.org/wang-ba-linux-wang-guan-she-zhi-ji-lu-bu-chong.html#comments</comments>
		<pubDate>Thu, 03 Nov 2011 02:23:43 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[nat]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[透明代理]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=766</guid>
		<description><![CDATA[很早之前写过这篇博文网吧Linux 网关设置记录，现在这台服务器终于玩完了，所以又要重新配置一台了。这次系统用的是CentOS 6 所以，有些东西变了，要记录一下。 squid.conf 中原来的 acl all src 0... ]]></description>
			<content:encoded><![CDATA[<p>很早之前写过这篇博文<a href="http://www.linuxbyte.org/linux-iptables-nat-squid-pdnsd.html">网吧Linux 网关设置记录</a>，现在这台服务器终于玩完了，所以又要重新配置一台了。这次系统用的是CentOS 6 所以，有些东西变了，要记录一下。</p>
<p>squid.conf 中原来的 acl all src 0.0.0.0/0，现在不需要定义了，squid 3.0 以后all 字段是默认设置了。<br />
<span id="more-766"></span><br />
sysctl.conf 优化中</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = <span style="color: #000000;">900</span></pre></div></div>

<p>net.ipv4.netfilter.ip_conntrack_tcp_timeout_established 已经改名了，改为net.netfilter.nf_conntrack_tcp_timeout_established 。</p>
<p>其实这一系列网络参数现在都改为net.netfilter.nf 开头了，所以原来的sysctl.conf 优化语句要改一下了。<br />
我的优化语句</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">net.netfilter.nf_conntrack_tcp_timeout_established= <span style="color: #000000;">180</span>
net.netfilter.nf_conntrack_tcp_timeout_fin_wait= <span style="color: #000000;">120</span>
net.netfilter.nf_conntrack_tcp_timeout_close_wait= <span style="color: #000000;">60</span>
net.netfilter.nf_conntrack_tcp_timeout_last_ack= <span style="color: #000000;">30</span>
net.netfilter.nf_conntrack_tcp_timeout_time_wait= <span style="color: #000000;">120</span>
net.ipv4.tcp_tw_reuse = <span style="color: #000000;">1</span>
net.ipv4.tcp_tw_recycle = <span style="color: #000000;">1</span>
net.ipv4.tcp_fin_timeout = <span style="color: #000000;">30</span>
net.ipv4.icmp_echo_ignore_all = <span style="color: #000000;">0</span>
net.ipv4.conf.all.proxy_arp = <span style="color: #000000;">1</span>
net.ipv4.tcp_synack_retries = <span style="color: #000000;">3</span></pre></div></div>

<p>另外加一条</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-A</span> PREROUTING <span style="color: #660033;">-s</span> 192.168.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> <span style="color: #660033;">-i</span> eth1 <span style="color: #660033;">-p</span> upd <span style="color: #660033;">--dport</span> <span style="color: #000000;">53</span> <span style="color: #660033;">-j</span> REDIRECT <span style="color: #660033;">--to-port</span> <span style="color: #000000;">53</span></pre></div></div>

<p>强制所有内网DNS请求都有网关解析。</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/linux-iptables-nat-squid-pdnsd.html" title="网吧Linux 网关设置记录">网吧Linux 网关设置记录</a></li><li><a href="http://www.linuxbyte.org/squid-tou-ming-dai-li-you-hua.html" title="Squid 透明代理优化">Squid 透明代理优化</a></li><li><a href="http://www.linuxbyte.org/refreshpattern-xue-xi-fan-li.html" title="refresh_pattern 学习范例">refresh_pattern 学习范例</a></li><li><a href="http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html" title="关于squid的一些记录">关于squid的一些记录</a></li><li><a href="http://www.linuxbyte.org/squid-xian-zhi-yong-hu-bing-fa-lian-jie-shu-2.html" title="Squid 限制用户并发连接数">Squid 限制用户并发连接数</a></li><li><a href="http://www.linuxbyte.org/%e5%8d%87%e7%ba%a7squid-26-%e5%88%b027-%e7%9a%84%e5%86%a4%e6%9e%89%e8%b7%af.html" title="升级squid 2.6 到2.7 的冤枉路">升级squid 2.6 到2.7 的冤枉路</a></li><li><a href="http://www.linuxbyte.org/squid-unofficial-support-for-rhelcentos.html" title="Squid unofficial support for RHEL/CentOS">Squid unofficial support for RHEL/CentOS</a></li><li><a href="http://www.linuxbyte.org/wang-ba-mei-ip-xian-su-bu-chong-squid-xian-su.html" title="网吧每IP 限速补充（squid 限速）">网吧每IP 限速补充（squid 限速）</a></li><li><a href="http://www.linuxbyte.org/iptables%ef%bc%8dtc-wang-ba-mei-ip-xian-su-jiao-ben.html" title="Iptables＋tc 网吧每IP 限速脚本">Iptables＋tc 网吧每IP 限速脚本</a></li><li><a href="http://www.linuxbyte.org/yong-iptables-er-fei-tc-xian-zhi-liu-liang.html" title="用Iptables 而非tc 限制流量">用Iptables 而非tc 限制流量</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/wang-ba-linux-wang-guan-she-zhi-ji-lu-bu-chong.html">网吧Linux 网关设置记录补充</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/iptables" rel="tag">iptables</a>, <a href="http://www.linuxbyte.org/tag/nat" rel="tag">nat</a>, <a href="http://www.linuxbyte.org/tag/squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/%e9%80%8f%e6%98%8e%e4%bb%a3%e7%90%86" rel="tag">透明代理</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/iptables" title="iptables" rel="tag">iptables</a>, <a href="http://www.linuxbyte.org/tag/nat" title="nat" rel="tag">nat</a>, <a href="http://www.linuxbyte.org/tag/squid" title="squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/%e9%80%8f%e6%98%8e%e4%bb%a3%e7%90%86" title="透明代理" rel="tag">透明代理</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/wang-ba-linux-wang-guan-she-zhi-ji-lu-bu-chong.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>备份VPS数据到Dropbox</title>
		<link>http://www.linuxbyte.org/bei-fen-vps-shu-ju-dao-dropbox.html</link>
		<comments>http://www.linuxbyte.org/bei-fen-vps-shu-ju-dao-dropbox.html#comments</comments>
		<pubDate>Sun, 08 May 2011 09:34:14 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[Dropbox]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[备份]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=722</guid>
		<description><![CDATA[数据备份的重要性我想不用强调大家都知道，而把数据异地备份更是提高数据安全的好手段。Dropbox 一个众所周知的好东西，跨平台，服务稳定，访问方式多样，免费2G空间。虽然在景德镇被和... ]]></description>
			<content:encoded><![CDATA[<p>数据备份的重要性我想不用强调大家都知道，而把数据异地备份更是提高数据安全的好手段。Dropbox 一个众所周知的好东西，跨平台，服务稳定，访问方式多样，免费2G空间。虽然在景德镇被和谐的但在国外还是速度杠杠的好。所以用它备份VPS 上的数据再好不过 。本文分两部分讨论，一本地的数据备份，二数据同步到<a href="http://db.tt/B3Y36lK">Dropbox</a>。<br />
<span id="more-722"></span><br />
一.备份你的数据<br />
用tar 做本博客的附件的增量备份。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#第一次备份</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> cvPf <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>xxx<span style="color: #000000; font-weight: bold;">/</span>linuxbyte.tar <span style="color: #000000; font-weight: bold;">/</span>xxx<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>linuxbyte.org<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #666666; font-style: italic;">#之后的增量备份</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> uPf <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>xxx<span style="color: #000000; font-weight: bold;">/</span>linuxbyte.tar <span style="color: #000000; font-weight: bold;">/</span>xxx<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>linuxbyte.org<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>加入crontab 任务，每周1，3，5 凌晨3：10时备份。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">10 3 * * 1,3,5 tar uPf /backup/xxx/linuxbyte.tar /xxx/web/linuxbyte.org/uploads/</pre></div></div>

<p>注意这里tar 用了绝对路径解压时加 &#8216;-C&#8217; 解压到指定目录，避免直接覆盖。</p>
<p>数据库备份<br />
创建 mysql.sh 内容为</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">#!/bin/bash
bakTime=`date +%w`
mysqldump  -uroot -ppassword linuxbyte_db &gt; /backup/mysql-datea/linuxbyte.sql-$bakTime</pre></div></div>

<p>加入crontab 任务，每周1，3，5 凌晨3：30时备份。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">30 3 * * 1,3,5 /backup/mysql.sh</pre></div></div>

<p>二.安装配置<a href="http://db.tt/B3Y36lK">Dropbox</a><br />
登录系统然后运行如下命令</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span>   
<span style="color: #666666; font-style: italic;">#32位系统：</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> dropbox.tar.gz <span style="color: #ff0000;">&quot;http://www.dropbox.com/download/?plat=lnx.x86&quot;</span>   
<span style="color: #666666; font-style: italic;">#64位系统：</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> dropbox.tar.gz <span style="color: #ff0000;">&quot;http://www.dropbox.com/download/?plat=lnx.x86_64&quot;</span>   
&nbsp;
<span style="color: #666666; font-style: italic;">#解压测试安装dropbox</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-tzf</span> dropbox.tar.gz   
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> dropbox.tar.gz
~<span style="color: #000000; font-weight: bold;">/</span>.dropbox-dist<span style="color: #000000; font-weight: bold;">/</span>dropboxd   
<span style="color: #666666; font-style: italic;">#然后你会得到如下输出</span>
This client is not linked to any account...
Please visit https:<span style="color: #000000; font-weight: bold;">//</span>www.dropbox.com<span style="color: #000000; font-weight: bold;">/</span>cli_link?<span style="color: #007800;">host_id</span>=7d44a557aa58f285f2da0x67334d02c1 <span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #007800;">cl</span>=en_US to <span style="color: #c20cb9; font-weight: bold;">link</span> this machine.</pre></div></div>

<p>在你的本地客户机上用Firefox+autoproxy 配合ssh 翻墙访问这个“https://www.dropbox.com/cli_link?host_id=7d44a557aa58f285f2da0x67334d02c1 &#038;cl=en_US”，关联你的dropbox账户。不要告诉我你不会用ssh 翻墙，你难道不是景德镇用户？</p>
<p>再回到你的服务器上在你的主目录下创建一个Dropbox目录，如此中间没什么错的话你就能成功同步了。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> Dropbox
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span> centos <span style="color: #666666; font-style: italic;">#为备份目录创建一个软链接到Dropbox下。</span></pre></div></div>

<p>创建/etc/init.d/dropbox文件，内容看<a href="http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall/FedoraStartup">这里</a></p>
<p>创建/etc/sysconfig/dropbox 文件，内容为</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">DROPBOX_USERS=&quot;username&quot;</pre></div></div>

<p>这个”username” 是你服务器上的用户名不是你的，Dropbox 用户名。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>dropbox start</pre></div></div>

<p>启动 dropbox 。</p>
<p>自此你的系统就能自动备份，并自动把备份同步到Dropbox了。Dropbox 服务吃内存还是很多的，所以还是有必要有限使用可以用Crontab 设置在特定时段启动而不是时时刻刻运行浪费内存。</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/gou-mai-vps-hou-de-yi-xie-cao-zuo.html" title="购买VPS 后的一些操作">购买VPS 后的一些操作</a></li><li><a href="http://www.linuxbyte.org/yi-ge-bu-cuo-de-firfox-bei-fen-cha-jian-febe.html" title="一个不错的firfox备份插件 &#8211;FEBE">一个不错的firfox备份插件 &#8211;FEBE</a></li><li><a href="http://www.linuxbyte.org/mianfei-wangpan-dropbox.html" title="免费网盘Dropbox">免费网盘Dropbox</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/bei-fen-vps-shu-ju-dao-dropbox.html">备份VPS数据到Dropbox</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/dropbox" rel="tag">Dropbox</a>, <a href="http://www.linuxbyte.org/tag/vps" rel="tag">vps</a>, <a href="http://www.linuxbyte.org/tag/%e5%a4%87%e4%bb%bd" rel="tag">备份</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/dropbox" title="Dropbox" rel="tag">Dropbox</a>, <a href="http://www.linuxbyte.org/tag/vps" title="vps" rel="tag">vps</a>, <a href="http://www.linuxbyte.org/tag/%e5%a4%87%e4%bb%bd" title="备份" rel="tag">备份</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/bei-fen-vps-shu-ju-dao-dropbox.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用 Awstats 后的一些小修改</title>
		<link>http://www.linuxbyte.org/shi-yong-awstats-hou-de-yi-xie-xiao-xiu-gai.html</link>
		<comments>http://www.linuxbyte.org/shi-yong-awstats-hou-de-yi-xie-xiao-xiu-gai.html#comments</comments>
		<pubDate>Fri, 29 Apr 2011 03:24:08 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[awstats]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=709</guid>
		<description><![CDATA[本位是上一篇用 awstats分析 Nginx 日志的一些记录的补充。 出现以下错误提示的 Error: LogFile parameter is not defined in config/domain file &#160; Setup ('www.linuxbyte.org' file, web server or permissions) may be wrong. Check c... ]]></description>
			<content:encoded><![CDATA[<p>本位是上一篇用 <a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html">awstats分析 Nginx 日志的一些记录</a>的补充。<br />
出现以下错误提示的</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Error: LogFile parameter is not defined in config/domain file
&nbsp;
Setup ('www.linuxbyte.org' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).</pre></div></div>

<p>文件权限问题，检查生成的文件的权限和文件宿主，不行直接chmod 777.<br />
<span id="more-709"></span><br />
<strong>默认字体大小</strong><br />
Awstats默认字体设置符合英文习惯的，所以需要改一下CSS，编辑/usr/local/awstats/wwwroot/cgi-bin/awstats.pl 文件，调整里面的字体和字体大小。</p>
<p><strong>编码问题</strong>，生成的文件默认是GBK 编码，但是搜索进来的关键字是UTF-8所以会出现乱码。</p>
<p>修改配置文件awstats.www.linuxbyte.org.conf<br />
 在配置文件中把decodeutfkeys这个plugin打开就可以了。在配置文件中找到：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"> #LoadPlugin=&quot;decodeutfkeys&quot;</pre></div></div>

<p>去掉“#” 解除注释，开启这一模块。</p>
<p><strong>禁止蜘蛛抓取</strong><br />
千万在robots.txt 设置禁止蜘蛛抓取，不然它来来回回给你抓个遍也是很浪费系统资源的。</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html" title="用 awstats分析 Nginx 日志的一些记录">用 awstats分析 Nginx 日志的一些记录</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/shi-yong-awstats-hou-de-yi-xie-xiao-xiu-gai.html">使用 Awstats 后的一些小修改</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/awstats" rel="tag">awstats</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/awstats" title="awstats" rel="tag">awstats</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/shi-yong-awstats-hou-de-yi-xie-xiao-xiu-gai.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>用 awstats分析 Nginx 日志的一些记录</title>
		<link>http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html</link>
		<comments>http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html#comments</comments>
		<pubDate>Wed, 27 Apr 2011 08:55:12 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[日志分析]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=701</guid>
		<description><![CDATA[系统环境为Cenots+Nginx 详细请阅读之前的日志《Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql》。 Awstats 是目前最流行的日志分析工具，它提供比第三方日志更方便更详实的日志分析。 系统默认Nginx 版... ]]></description>
			<content:encoded><![CDATA[<p>系统环境为Cenots+Nginx 详细请阅读之前的日志《<a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a>》。<br />
Awstats 是目前最流行的日志分析工具，它提供比第三方日志更方便更详实的日志分析。<br />
<span id="more-701"></span><br />
系统默认Nginx 版本为 1.0.0，日志格式 Awstats 可以直接识别，并且由logrotate 做了日志回滚，每日对日志进行截断。为了得到更准确的分析结果并且尽量少占用系统资源，我每天在凌晨分析上一天的日志，并将结果输出为纯静态文件。由于logrotate 压缩了旧日志所以要修改logrotate 设置不压缩就日志。<br />
修改vi /etc/logrotate.d/nginx</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">/var/log/nginx/*log {
    daily
    rotate 10 #保留10天的日志
    missingok
    notifempty
    nocompress #就是这里默认是compress压缩日志
    sharedscripts
    postrotate
        [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
    endscript
}</pre></div></div>

<p>下载安装Awstats</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>prdownloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>awstats-<span style="color: #000000;">7.0</span>-<span style="color: #000000;">1</span>.noarch.rpm
rpm <span style="color: #660033;">-ivh</span> awstats-<span style="color: #000000;">7.0</span>-<span style="color: #000000;">1</span>.noarch.rpm</pre></div></div>

<p>配置</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>tools
<span style="color: #c20cb9; font-weight: bold;">perl</span> awstats_configure.pl</pre></div></div>

<p>由于我们的web服务器是Nginx 所以 Check for web server install 我们选 none</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">-----&gt; Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y #这里选Y
&nbsp;
-----&gt; Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
&gt; www.linuxbyte.org #输入你要统计的网站的域名</pre></div></div>

<p>编辑/etc/awstats/awstats.www.linuxbyte.org.conf<br />
修改 LogFile 段加入网站日志的路径。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">LogFile=&quot;/var/log/nginx/www.linuxbyte.org.access.log.1&quot;</pre></div></div>

<p>生成份分析结果的静态文件</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>linuxbyte.org<span style="color: #000000; font-weight: bold;">/</span>awstats
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>wwwroot<span style="color: #000000; font-weight: bold;">/</span>icon<span style="color: #000000; font-weight: bold;">/</span> .<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-rf</span> 
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>awstats_buildstaticpages.pl <span style="color: #660033;">-config</span>=www.linuxbyte.org <span style="color: #660033;">-lang</span>=cn <span style="color: #660033;">-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>linuxbyte<span style="color: #000000; font-weight: bold;">/</span>awstats <span style="color: #660033;">-update</span></pre></div></div>

<p>自此你可以访问http://www.linuxbyte.org/awstats/awstats.www.linuxbyte.org.html 来查看分析结果。</p>
<p>设置crontable</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">30 4 * * */usr/local/awstats/tools/awstats_buildstaticpages.pl -config=www.linuxbyte.org -lang=cn -dir=/web/linuxbyte/awstats -update</pre></div></div>

<p>每天凌晨 4：30 分析日志，因为这个时候是服务器最空闲的时段。</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/shi-yong-awstats-hou-de-yi-xie-xiao-xiu-gai.html" title="使用 Awstats 后的一些小修改">使用 Awstats 后的一些小修改</a></li><li><a href="http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html" title="Nginx 限制并发连接数">Nginx 限制并发连接数</a></li><li><a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html" title="Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a></li><li><a href="http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html" title="Nginx下实现gzip静态文件压缩">Nginx下实现gzip静态文件压缩</a></li><li><a href="http://www.linuxbyte.org/nginx-install.html" title="Nginx 安装">Nginx 安装</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html">用 awstats分析 Nginx 日志的一些记录</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/awstats" rel="tag">awstats</a>, <a href="http://www.linuxbyte.org/tag/nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/%e6%97%a5%e5%bf%97%e5%88%86%e6%9e%90" rel="tag">日志分析</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/awstats" title="awstats" rel="tag">awstats</a>, <a href="http://www.linuxbyte.org/tag/nginx" title="nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/%e6%97%a5%e5%bf%97%e5%88%86%e6%9e%90" title="日志分析" rel="tag">日志分析</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx 限制并发连接数</title>
		<link>http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html</link>
		<comments>http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html#comments</comments>
		<pubDate>Sat, 26 Mar 2011 15:23:29 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[并发连接数]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=671</guid>
		<description><![CDATA[在http 段添加下面语句定义一个记录区 limit_zone myzone $binary_remote_addr 10m; 在server 段加入下面语句，限制并发数为十。 limit_conn myzone 10; 与本文关系暧昧的文字用 awstats分析 Nginx 日志的一些记录Cent... ]]></description>
			<content:encoded><![CDATA[<p>在http 段添加下面语句定义一个记录区</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  limit_zone   myzone  $binary_remote_addr  10m;</pre></div></div>

<p>在server 段加入下面语句，限制并发数为十。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    limit_conn   myzone  10;</pre></div></div>

<p><span id="more-671"></span></p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html" title="用 awstats分析 Nginx 日志的一些记录">用 awstats分析 Nginx 日志的一些记录</a></li><li><a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html" title="Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a></li><li><a href="http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html" title="Nginx下实现gzip静态文件压缩">Nginx下实现gzip静态文件压缩</a></li><li><a href="http://www.linuxbyte.org/nginx-install.html" title="Nginx 安装">Nginx 安装</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html">Nginx 限制并发连接数</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/%e5%b9%b6%e5%8f%91%e8%bf%9e%e6%8e%a5%e6%95%b0" rel="tag">并发连接数</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/nginx" title="nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/%e5%b9%b6%e5%8f%91%e8%bf%9e%e6%8e%a5%e6%95%b0" title="并发连接数" rel="tag">并发连接数</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</title>
		<link>http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html</link>
		<comments>http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html#comments</comments>
		<pubDate>Tue, 22 Mar 2011 06:59:53 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[eaccelerator]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=662</guid>
		<description><![CDATA[记录下我在linodeVPS 的Centos下安装配置nginx+PHP-FPM+eAccelerator+mysql的过程。 添加安装源 Centos 默认官方源中没有nginx 和 php-fpm 所以必须添加第三方源，不然就只能自己编译了。 添加[CentALT]源 在/etc/y... ]]></description>
			<content:encoded><![CDATA[<p>记录下我在<a href="http://www.linode.com/?r=558aa1aed383ae43555fab01b4c51359f6035a97">linode</a>VPS 的Centos下安装配置nginx+PHP-FPM+eAccelerator+mysql的过程。</p>
<p><strong>添加安装源</strong><br />
Centos 默认官方源中没有nginx 和 php-fpm 所以必须添加第三方源，不然就只能自己编译了。<br />
<span id="more-662"></span><br />
添加[CentALT]源<br />
在/etc/yum.repo.d 目下创建 alt.ru.repo 文件内容如下：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">[CentALT]
name=CentALT Packages for Enterprise Linux 5 - $basearch
baseurl=http://centos.alt.ru/repository/centos/5/$basearch/
enabled=1
gpgcheck=0</pre></div></div>

<p>启用 EPEL</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm <span style="color: #660033;">-Uvh</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.fedora.redhat.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>epel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>x86_64<span style="color: #000000; font-weight: bold;">/</span>epel-release-<span style="color: #000000;">5</span>-<span style="color: #000000;">4</span>.noarch.rpm</pre></div></div>

<p>32系统的用下面命令</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm -Uvhhttp:<span style="color: #000000; font-weight: bold;">//</span>download.fedora.redhat.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>epel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>i386<span style="color: #000000; font-weight: bold;">/</span>epel-release-<span style="color: #000000;">5</span>-<span style="color: #000000;">4</span>.noarch.rpm</pre></div></div>

<p><strong>安装 nginx +PHP-FPM +eAccelerator +mysql</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum update
 yum <span style="color: #c20cb9; font-weight: bold;">install</span> nginx php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator</pre></div></div>

<p><strong>配置优化Nginx</strong><br />
修改 /etc/nginx/nginx.conf,下面只列出修改的部分。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">#根据CPU 核心processes，VPS下几个核心几个processes，独立服务器可x2
worker_processes  4;
&nbsp;
#启用epoll
worker_rlimit_nofile 51200;
events {
    worker_connections  51200;
    use epoll;
}
#参数调整
    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;
    server_tokens   off;
    keepalive_timeout  50;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 50m;
#fastcgi优化
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 256k;
&nbsp;
#开启gzip并优化
    gzip on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css application/xml;
    gzip_vary on;</pre></div></div>

<p><strong>php-fpm 调整</strong><br />
修改/etc/php-fpm.conf 将max_children 调为20</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;max_children&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>20<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><strong>mysql 调整</strong><br />
修改/etc/my.conf [mysqld] 段加入如下指令</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">skip-network
skip-innodb
skip-locking
skip-bdb
&nbsp;
key_buffer              = 16K
max_allowed_packet      = 3M
thread_stack            = 64K
thread_cache_size       = 8
table_cache             = 3
query_cache_limit       = 1M
query_cache_size        = 16M</pre></div></div>

<p><strong>系统内核调整</strong><br />
在/etc/sysctl.conf 加入</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 5000    65000
net.ipv4.tcp_max_tw_buckets = 6000</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> “<span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-SHn</span> <span style="color: #000000;">65535</span>” <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.local
styctl <span style="color: #660033;">-p</span></pre></div></div>

<p>开启服务并设置系统启动默认启动</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-SHn</span> <span style="color: #000000;">65535</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nginx  start
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>php-fpm start
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysqld start
chkconfig nginx on
chkconfig php-fpm on
chkconfig mysqld on</pre></div></div>

<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/yong-awstats-fen-xi-nginx-ri-zhi-de-yi-xie-ji-lu.html" title="用 awstats分析 Nginx 日志的一些记录">用 awstats分析 Nginx 日志的一些记录</a></li><li><a href="http://www.linuxbyte.org/nginx-xian-zhi-bing-fa-lian-jie-shu.html" title="Nginx 限制并发连接数">Nginx 限制并发连接数</a></li><li><a href="http://www.linuxbyte.org/php-5-3-4-fa-bu.html" title="PHP 5.3.4 发布 ">PHP 5.3.4 发布 </a></li><li><a href="http://www.linuxbyte.org/mysql-slave-pei-zhi-bei-fen.html" title="mysql slave 配置备份">mysql slave 配置备份</a></li><li><a href="http://www.linuxbyte.org/my-cnf-master.html" title="mysql master 配置备份">mysql master 配置备份</a></li><li><a href="http://www.linuxbyte.org/yi-ge-mysql-server-shang-de-xiao-ji-qiao.html" title="一个 mysql server 上的小技巧">一个 mysql server 上的小技巧</a></li><li><a href="http://www.linuxbyte.org/tui-jian-ge-php-bian-ji-qi-gphpedit.html" title="推荐个PHP 编辑器 Gphpedit">推荐个PHP 编辑器 Gphpedit</a></li><li><a href="http://www.linuxbyte.org/centos-xia-an-zhuang-pei-zhi-powerdns.html" title="Centos 下安装配置 PowerDNS ">Centos 下安装配置 PowerDNS </a></li><li><a href="http://www.linuxbyte.org/jia-gu-wen-xiang-mysqlyong-hu-kai-fa-zhe-he-ke-hu-de-shi-xiang-cheng-nuo.html" title="甲骨文向MySQL用户、开发者和客户的十项承诺">甲骨文向MySQL用户、开发者和客户的十项承诺</a></li><li><a href="http://www.linuxbyte.org/nginx-shixian-gzip-jingtai-wenjian-yasuo.html" title="Nginx下实现gzip静态文件压缩">Nginx下实现gzip静态文件压缩</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/eaccelerator" rel="tag">eaccelerator</a>, <a href="http://www.linuxbyte.org/tag/mysql" rel="tag">mysql</a>, <a href="http://www.linuxbyte.org/tag/nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/php" rel="tag">php</a>, <a href="http://www.linuxbyte.org/tag/php-fpm" rel="tag">php-fpm</a>, <a href="http://www.linuxbyte.org/tag/yum" rel="tag">yum</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/eaccelerator" title="eaccelerator" rel="tag">eaccelerator</a>, <a href="http://www.linuxbyte.org/tag/mysql" title="mysql" rel="tag">mysql</a>, <a href="http://www.linuxbyte.org/tag/nginx" title="nginx" rel="tag">nginx</a>, <a href="http://www.linuxbyte.org/tag/php" title="php" rel="tag">php</a>, <a href="http://www.linuxbyte.org/tag/php-fpm" title="php-fpm" rel="tag">php-fpm</a>, <a href="http://www.linuxbyte.org/tag/yum" title="yum" rel="tag">yum</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>refresh_pattern 学习范例</title>
		<link>http://www.linuxbyte.org/refreshpattern-xue-xi-fan-li.html</link>
		<comments>http://www.linuxbyte.org/refreshpattern-xue-xi-fan-li.html#comments</comments>
		<pubDate>Thu, 03 Mar 2011 09:46:56 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[refresh_pattern]]></category>
		<category><![CDATA[squid]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=627</guid>
		<description><![CDATA[一份很强的refresh_pattern 规则。关于refresh_pattern 的用法可以阅读扶凯的文章 # $Rev$ # chudy_fernandez@yahoo.com # 1 year = 525600 mins, 1 month = 43800 mins refresh_pattern (get_video&#124;videoplayback&#124;videodownload&#124;\.fl... ]]></description>
			<content:encoded><![CDATA[<p>一份很强的refresh_pattern 规则。关于refresh_pattern 的用法可以阅读扶凯的<a href="http://www.php-oa.com/2008/01/22/zaisquid26zhongrefrerefresh_patterndeyixielijiehejianyi.html">文章</a></p>
<p><span id="more-627"></span></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"># $Rev$
# chudy_fernandez@yahoo.com
# 1 year = 525600 mins, 1 month = 43800 mins
refresh_pattern (get_video|videoplayback|videodownload|\.flv).*(begin|start)\=[1-9][0-9]*	0 0% 0
refresh_pattern imeem.*\.flv 		0 0% 0 				override-lastmod override-expire
refresh_pattern ^ftp:				40320	20%	40320 	override-expire reload-into-ims store-stale
refresh_pattern ^gopher:			1440	0%	1440 
refresh_pattern code.googlec.com.*(svn|download)			0	50%	1440	reload-into-ims
&nbsp;
#ads
refresh_pattern ^.*(streamate.doublepimp.com.*\.js\?|utm\.gif|ads\?|rmxads\.com|ad\.z5x\.net|bh\.contextweb\.com|bstats\.adbrite\.com|a1\.interclick\.com|ad\.trafficmp\.com|ads\.cubics\.com|ad\.xtendmedia\.com|\.googlesyndication\.com|advertising\.com|yieldmanager|game-advertising\.com|pixel\.quantserve\.com|adperium\.com|doubleclick\.net|adserving\.cpxinteractive\.com|syndication\.com|media.fastclick.net).* 5259487 20% 5259487 ignore-no-cache ignore-no-store ignore-private override-expire ignore-reload ignore-auth ignore-must-revalidate store-stale negative-ttl=40320 max-stale=1440
&nbsp;
#antivirus
refresh_pattern avast.com.*\.vpx																			40320 50% 161280		store-stale reload-into-ims
refresh_pattern (avgate|avira).*\.(idx|gz)$																	1440 90% 1440 			ignore-reload ignore-no-cache ignore-no-store store-stale ignore-must-revalidate 
refresh_pattern kaspersky.*\.avc$																			5259487 999999% 5259487	ignore-reload store-stale
refresh_pattern kaspersky																					1440 50% 161280			ignore-no-cache store-stale
refresh_pattern mbamupdates.com.*\.ref																		1440 50% 161280			reload-into-ims store-stale
&nbsp;
#specific sites
refresh_pattern \.rapidshare.*\/[0-9]*\/.*\/[^\/]* 															161280	90%	161280 ignore-reload store-stale
refresh_pattern (get_video\?|videoplayback\?|videodownload\?|\.flv\?|\.fid\?) 										5259487 99999999% 5259487 override-expire ignore-reload store-stale ignore-private negative-ttl=0
refresh_pattern \.(ico|video-stats) 																		5259487 999999% 5259487	override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth override-lastmod ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern \.etology\?	 																				5259487 999999% 5259487	override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern galleries\.video(\?|sz) 																	5259487 999999% 5259487	override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern brazzers\?	 																				5259487 999999% 5259487	override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern \.adtology\?																				5259487 999999% 5259487	override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern ^.*safebrowsing.*google 																	5259487 999999% 5259487	override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern ^http://((cbk|mt|khm|mlt)[0-9]?)\.google\.co(m|\.uk) 										5259487 999999% 5259487	override-expire ignore-reload store-stale ignore-private negative-ttl=10080
refresh_pattern ytimg\.com.*\.(jpg|png)																		5259487 999999% 5259487	override-expire ignore-reload store-stale
refresh_pattern images\.friendster\.com.*\.(png|gif) 														5259487 999999% 5259487	override-expire ignore-reload store-stale
refresh_pattern ((facebook.com)|(85.131.151.39)).*\.(png|gif)												5259487 999999% 5259487	override-expire ignore-reload store-stale
refresh_pattern garena\.com																					5259487 999999% 5259487	override-expire reload-into-ims store-stale
refresh_pattern photobucket.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png) 												5259487 999999% 5259487	override-expire ignore-reload store-stale
refresh_pattern vid\.akm\.dailymotion\.com.*\.on2\? 														5259487 999999% 5259487	ignore-no-cache override-expire override-lastmod store-stale
refresh_pattern .fbcdn.net.*\.(jpg|gif|png)																	5259487 999999% 5259487	ignore-no-cache override-expire ignore-reload store-stale negative-ttl=0
refresh_pattern ^http:\/\/images|pics|thumbs[0-9]\. 														5259487 999999% 5259487	ignore-no-cache ignore-no-store ignore-reload override-expire store-stale
refresh_pattern ^http:\/\/www.onemanga.com.*\/ 																5259487 999999% 5259487	reload-into-ims override-expire store-stale
refresh_pattern mediafire.com\/images.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png) 									5259487 999999% 5259487	reload-into-ims override-expire ignore-private store-stale
&nbsp;
#general
refresh_pattern \.(jp(e?g|e|2)|tiff?|bmp|gif|png) 															5259487 999999% 5259487	ignore-no-cache ignore-no-store reload-into-ims override-expire ignore-must-revalidate store-stale
refresh_pattern \.(z(ip|[0-9]{2})|r(ar|[0-9]{2})|jar|bz2|gz|tar|rpm|vpu) 									5259487 999999% 5259487	override-expire reload-into-ims
refresh_pattern \.(mp3|wav|og(g|a)|flac|midi?|rm|aac|wma|mka|ape) 											5259487 999999% 5259487	override-expire reload-into-ims ignore-reload
refresh_pattern \.(exe|msi|dmg|bin|xpi|iso|swf|mar|psf|cab)													5259487 999999% 5259487	override-expire reload-into-ims ignore-no-cache ignore-must-revalidate
refresh_pattern \.(mpeg|ra?m|avi|mp(g|e|4)|mov|divx|asf|wmv|m\dv|rv|vob|asx|ogm|flv|3gp|on2)				5259487 9999999% 5259487 override-expire reload-into-ims
refresh_pattern -i (cgi-bin) 0 0% 0
refresh_pattern \.(php|jsp|cgi|asx)\? 0 0% 0
refresh_pattern . 0 50% 161280 store-stale</pre></div></div>

<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/wang-ba-linux-wang-guan-she-zhi-ji-lu-bu-chong.html" title="网吧Linux 网关设置记录补充">网吧Linux 网关设置记录补充</a></li><li><a href="http://www.linuxbyte.org/squid-tou-ming-dai-li-you-hua.html" title="Squid 透明代理优化">Squid 透明代理优化</a></li><li><a href="http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html" title="关于squid的一些记录">关于squid的一些记录</a></li><li><a href="http://www.linuxbyte.org/squid-xian-zhi-yong-hu-bing-fa-lian-jie-shu-2.html" title="Squid 限制用户并发连接数">Squid 限制用户并发连接数</a></li><li><a href="http://www.linuxbyte.org/%e5%8d%87%e7%ba%a7squid-26-%e5%88%b027-%e7%9a%84%e5%86%a4%e6%9e%89%e8%b7%af.html" title="升级squid 2.6 到2.7 的冤枉路">升级squid 2.6 到2.7 的冤枉路</a></li><li><a href="http://www.linuxbyte.org/squid-unofficial-support-for-rhelcentos.html" title="Squid unofficial support for RHEL/CentOS">Squid unofficial support for RHEL/CentOS</a></li><li><a href="http://www.linuxbyte.org/wang-ba-mei-ip-xian-su-bu-chong-squid-xian-su.html" title="网吧每IP 限速补充（squid 限速）">网吧每IP 限速补充（squid 限速）</a></li><li><a href="http://www.linuxbyte.org/qzone-squid-iptables.html" title="新版qzone 无法被squid 缓存">新版qzone 无法被squid 缓存</a></li><li><a href="http://www.linuxbyte.org/squid-havp-clamav.html" title="squid+havp+clamav搭建防毒代理">squid+havp+clamav搭建防毒代理</a></li><li><a href="http://www.linuxbyte.org/linux-iptables-nat-squid-pdnsd.html" title="网吧Linux 网关设置记录">网吧Linux 网关设置记录</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/refreshpattern-xue-xi-fan-li.html">refresh_pattern 学习范例</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/refresh_pattern" rel="tag">refresh_pattern</a>, <a href="http://www.linuxbyte.org/tag/squid" rel="tag">squid</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/refresh_pattern" title="refresh_pattern" rel="tag">refresh_pattern</a>, <a href="http://www.linuxbyte.org/tag/squid" title="squid" rel="tag">squid</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/refreshpattern-xue-xi-fan-li.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squid 透明代理优化</title>
		<link>http://www.linuxbyte.org/squid-tou-ming-dai-li-you-hua.html</link>
		<comments>http://www.linuxbyte.org/squid-tou-ming-dai-li-you-hua.html#comments</comments>
		<pubDate>Wed, 02 Mar 2011 12:14:20 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[透明代理]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=626</guid>
		<description><![CDATA[主要记录下用Squid 做正向代理（透明代理）时的优化设置，一切尚在调试中所以下面的优化方式未必都是正确的。 内核调整 /etc/sysctl.conf 下面添加 net.ipv4.netfilter.ip_conntrack_tcp_timeout_established =900... ]]></description>
			<content:encoded><![CDATA[<p>主要记录下用Squid 做正向代理（透明代理）时的优化设置，一切尚在调试中所以下面的优化方式未必都是正确的。</p>
<p><strong>内核调整</strong><br />
/etc/sysctl.conf 下面添加<br />
<span id="more-626"></span></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">net.ipv4.netfilter.ip_conntrack_tcp_timeout_established =900
net.ipv4.icmp_echo_ignore_all = 0
net.ipv4.conf.all.proxy_arp = 1
net.ipv4.tcp_synack_retries = 3
net.ipv4.ip_conntrack_max = 81920
net.ipv4.tcp_fin_timeout = 5
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000</pre></div></div>

<p>使设置生效</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>sysctl <span style="color: #660033;">-p</span></pre></div></div>

<p><strong>文件系统设置</strong><br />
将squid缓存放入独立的文件系统中，文件系统格式建议用Reiserfs，挂载时使用&#8217;noatime&#8217;参数提高IO性能。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">LABEL=/squid             /squid               reiserfs    defaults,noatime     0 0</pre></div></div>

<p><strong>squid.conf</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">http_port 192.168.0.254:3128 transparent
cache_mgr hew@linuxbyte.org
cache_mem 512 MB
cache_dir ufs /squid/squid 51200 12 256
maximum_object_size_in_memory 128 KB
maximum_object_size 64 MB
&nbsp;
#cache_access_log /var/log/squid/access.log squid
cache_access_log none
cache_log none
cache_store_log none
#logfile_rotate 4
&nbsp;
max_filedesc 6144
pipeline_prefetch on
memory_pools off
memory_pools_limit none
mime_table /etc/squid/mime.conf
&nbsp;
refresh_pattern -i \.css$ 1440 50% 129600 reload-into-ims
refresh_pattern -i \.xml$ 1440 50% 129600 reload-into-ims
refresh_pattern -i \.htm$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.html$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.shtml$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.png$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.jpg$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.jpeg$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.gif$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.bmp$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.js$ 1440 90% 129600 reload-into-ims
&nbsp;
refresh_pattern -i \.mp3$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.wmv$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.rm$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.swf$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.mpeg$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.wma$ 1440 50% 2880 ignore-reload
&nbsp;
refresh_pattern -i \.exe$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.rar$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.zip$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.gz$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.bz2$ 1440 50% 2880 ignore-reload
refresh_pattern -i \.7z$ 1440 50% 2880 ignore-reload
&nbsp;
client_lifetime 1 hours
half_closed_clients off
visible_hostname proxy.linuxbyte.org
&nbsp;
cache_effective_user squid
cache_effective_group squid
&nbsp;
cache_swap_low 75
cache_swap_high 95
&nbsp;
dns_nameservers 192.168.0.254
&nbsp;
acl QUERY urlpath_regex -i cgi-bin \?
cache deny QUERY
&nbsp;
acl all src 0.0.0.0/0
acl localnet src 192.168.0.0/24
http_access allow localnet
http_access deny all</pre></div></div>

<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/wang-ba-linux-wang-guan-she-zhi-ji-lu-bu-chong.html" title="网吧Linux 网关设置记录补充">网吧Linux 网关设置记录补充</a></li><li><a href="http://www.linuxbyte.org/linux-iptables-nat-squid-pdnsd.html" title="网吧Linux 网关设置记录">网吧Linux 网关设置记录</a></li><li><a href="http://www.linuxbyte.org/refreshpattern-xue-xi-fan-li.html" title="refresh_pattern 学习范例">refresh_pattern 学习范例</a></li><li><a href="http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html" title="关于squid的一些记录">关于squid的一些记录</a></li><li><a href="http://www.linuxbyte.org/squid-xian-zhi-yong-hu-bing-fa-lian-jie-shu-2.html" title="Squid 限制用户并发连接数">Squid 限制用户并发连接数</a></li><li><a href="http://www.linuxbyte.org/%e5%8d%87%e7%ba%a7squid-26-%e5%88%b027-%e7%9a%84%e5%86%a4%e6%9e%89%e8%b7%af.html" title="升级squid 2.6 到2.7 的冤枉路">升级squid 2.6 到2.7 的冤枉路</a></li><li><a href="http://www.linuxbyte.org/squid-unofficial-support-for-rhelcentos.html" title="Squid unofficial support for RHEL/CentOS">Squid unofficial support for RHEL/CentOS</a></li><li><a href="http://www.linuxbyte.org/wang-ba-mei-ip-xian-su-bu-chong-squid-xian-su.html" title="网吧每IP 限速补充（squid 限速）">网吧每IP 限速补充（squid 限速）</a></li><li><a href="http://www.linuxbyte.org/qzone-squid-iptables.html" title="新版qzone 无法被squid 缓存">新版qzone 无法被squid 缓存</a></li><li><a href="http://www.linuxbyte.org/squid-havp-clamav.html" title="squid+havp+clamav搭建防毒代理">squid+havp+clamav搭建防毒代理</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/squid-tou-ming-dai-li-you-hua.html">Squid 透明代理优化</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/%e9%80%8f%e6%98%8e%e4%bb%a3%e7%90%86" rel="tag">透明代理</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/squid" title="squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/%e9%80%8f%e6%98%8e%e4%bb%a3%e7%90%86" title="透明代理" rel="tag">透明代理</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/squid-tou-ming-dai-li-you-hua.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于squid的一些记录</title>
		<link>http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html</link>
		<comments>http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html#comments</comments>
		<pubDate>Tue, 01 Mar 2011 06:07:26 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[系统管理]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[优化]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=624</guid>
		<description><![CDATA[max_filedesc 问题 CentOS 5 中自带 Squid 是打过REDHAT的fd补丁的，所以可以直接用max_filedesc 参数加大squid 的最大文件打开数，不过在启动squid之前要运行下 ulimit -HSn xxxxx 关于这个问题更多的可阅读下... ]]></description>
			<content:encoded><![CDATA[<p><strong>max_filedesc 问题</strong><br />
CentOS 5 中自带 Squid 是打过REDHAT的fd补丁的，所以可以直接用max_filedesc 参数加大squid 的最大文件打开数，不过在启动squid之前要运行下</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-HSn</span> xxxxx</pre></div></div>

<p><span id="more-624"></span><br />
关于这个问题更多的可阅读下面文章：<br />
<a href="http://www.linuxbyte.org/squid-max_filedesc.html">http://www.linuxbyte.org/squid-max_filedesc.html</a></p>
<p><strong>maximum_object_size_in_memory 的大小</strong></p>
<p>查看Cache information for squid:中下面这段</p>
<p>Storage Swap size: 7549104 KB<br />
Storage Mem size: 418804 KB<br />
Mean Object Size: 160.46 KB</p>
<p>Mean Object Size是平均内容大小，一般要把maximum_object_size_in_memory设置成离它最近的128的倍数。在这个例子中maximum_object_size_in_memory 的值应该是256kB。</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/wang-ba-linux-wang-guan-she-zhi-ji-lu-bu-chong.html" title="网吧Linux 网关设置记录补充">网吧Linux 网关设置记录补充</a></li><li><a href="http://www.linuxbyte.org/refreshpattern-xue-xi-fan-li.html" title="refresh_pattern 学习范例">refresh_pattern 学习范例</a></li><li><a href="http://www.linuxbyte.org/squid-tou-ming-dai-li-you-hua.html" title="Squid 透明代理优化">Squid 透明代理优化</a></li><li><a href="http://www.linuxbyte.org/squid-xian-zhi-yong-hu-bing-fa-lian-jie-shu-2.html" title="Squid 限制用户并发连接数">Squid 限制用户并发连接数</a></li><li><a href="http://www.linuxbyte.org/%e5%8d%87%e7%ba%a7squid-26-%e5%88%b027-%e7%9a%84%e5%86%a4%e6%9e%89%e8%b7%af.html" title="升级squid 2.6 到2.7 的冤枉路">升级squid 2.6 到2.7 的冤枉路</a></li><li><a href="http://www.linuxbyte.org/squid-unofficial-support-for-rhelcentos.html" title="Squid unofficial support for RHEL/CentOS">Squid unofficial support for RHEL/CentOS</a></li><li><a href="http://www.linuxbyte.org/wang-ba-mei-ip-xian-su-bu-chong-squid-xian-su.html" title="网吧每IP 限速补充（squid 限速）">网吧每IP 限速补充（squid 限速）</a></li><li><a href="http://www.linuxbyte.org/ubuntu-904-an-zhuang-pei-zhi-you-hua-quan-ji-lu.html" title="ubuntu 9.04 安装配置优化全记录">ubuntu 9.04 安装配置优化全记录</a></li><li><a href="http://www.linuxbyte.org/qzone-squid-iptables.html" title="新版qzone 无法被squid 缓存">新版qzone 无法被squid 缓存</a></li><li><a href="http://www.linuxbyte.org/squid-havp-clamav.html" title="squid+havp+clamav搭建防毒代理">squid+havp+clamav搭建防毒代理</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2011<br />
Source: <a href="http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html">关于squid的一些记录</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/%e4%bc%98%e5%8c%96" rel="tag">优化</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/squid" title="squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/%e4%bc%98%e5%8c%96" title="优化" rel="tag">优化</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/guan-yu-squid-de-yi-xie-ji-lu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql slave 配置备份</title>
		<link>http://www.linuxbyte.org/mysql-slave-pei-zhi-bei-fen.html</link>
		<comments>http://www.linuxbyte.org/mysql-slave-pei-zhi-bei-fen.html#comments</comments>
		<pubDate>Mon, 14 Jun 2010 08:46:03 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[slave]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=568</guid>
		<description><![CDATA[mysql slave 配置备份 [client] port = 3306 socket = /tmp/mysql.sock [mysqld] port = 3306 socket = /tmp/mysql.sock skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = ... ]]></description>
			<content:encoded><![CDATA[<p>mysql slave 配置备份<br />
[client]<br />
port        = 3306<br />
socket        = /tmp/mysql.sock<br />
<span id="more-568"></span><br />
[mysqld]<br />
port        = 3306<br />
socket        = /tmp/mysql.sock<br />
skip-locking<br />
key_buffer = 16M<br />
max_allowed_packet = 1M<br />
table_cache = 64<br />
sort_buffer_size = 512K<br />
net_buffer_length = 8K<br />
read_buffer_size = 256K<br />
read_rnd_buffer_size = 512K<br />
myisam_sort_buffer_size = 8M<br />
skip-federated</p>
<p>###################   slave  ##########################<br />
server-id    = 2<br />
master-host=192.168.1.221<br />
master-user=reply<br />
master-password=reply123456<br />
replicate-do-db =mydns<br />
log-bin=n01-bin<br />
slave-net-timeout=60</p>
<p>####################################################</p>
<p>long_query_time = 5<br />
expire_logs_days= 3<br />
thread_concurrency = 8<br />
thread_cache_size = 64<br />
max_connections = 4000<br />
query_cache_size = 256M<br />
open_files_limit = 10000<br />
max_heap_table_size = 64M<br />
innodb_file_per_table<br />
innodb_flush_method=O_DIRECT<br />
innodb_buffer_pool_size=120M<br />
innodb_additional_mem_pool_size=100M<br />
innodb_support_xa=0<br />
innodb_thread_concurrency=0<br />
innodb_flush_log_at_trx_commit=1<br />
#####################################<br />
interactive_timeout=180<br />
wait_timeout=180<br />
#####################################</p>
<p>[mysqldump]<br />
quick<br />
max_allowed_packet = 16M</p>
<p>[mysql]<br />
no-auto-rehash</p>
<p>[isamchk]<br />
key_buffer = 20M<br />
sort_buffer_size = 20M<br />
read_buffer = 2M<br />
write_buffer = 2M</p>
<p>[myisamchk]<br />
key_buffer = 20M<br />
sort_buffer_size = 20M<br />
read_buffer = 2M<br />
write_buffer = 2M</p>
<p>[mysqlhotcopy]<br />
interactive-timeout,u</p>
<h2  class="related_post_title">与本文关系暧昧的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/centos-yum-an-zhuang-nginx-php-fpm-eaccelerator-mysql.html" title="Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql">Centos yum 安装nginx+PHP-FPM+eAccelerator+mysql</a></li><li><a href="http://www.linuxbyte.org/my-cnf-master.html" title="mysql master 配置备份">mysql master 配置备份</a></li><li><a href="http://www.linuxbyte.org/yi-ge-mysql-server-shang-de-xiao-ji-qiao.html" title="一个 mysql server 上的小技巧">一个 mysql server 上的小技巧</a></li><li><a href="http://www.linuxbyte.org/centos-xia-an-zhuang-pei-zhi-powerdns.html" title="Centos 下安装配置 PowerDNS ">Centos 下安装配置 PowerDNS </a></li><li><a href="http://www.linuxbyte.org/jia-gu-wen-xiang-mysqlyong-hu-kai-fa-zhe-he-ke-hu-de-shi-xiang-cheng-nuo.html" title="甲骨文向MySQL用户、开发者和客户的十项承诺">甲骨文向MySQL用户、开发者和客户的十项承诺</a></li><li><a href="http://www.linuxbyte.org/what-to-tune-in-mysql-server-after-installation.html" title="What to tune in MySQL Server after installation">What to tune in MySQL Server after installation</a></li><li><a href="http://www.linuxbyte.org/mysql-backup-restore.html" title="MySQL数据库备份和还原的常用命令">MySQL数据库备份和还原的常用命令</a></li><li><a href="http://www.linuxbyte.org/change-mysql-root-passwd.html" title="MySQL修改root密码的多种方法">MySQL修改root密码的多种方法</a></li><li><a href="http://www.linuxbyte.org/optimization-mysql-database-under-high-load-server.html" title="linux高负载下彻底优化mysql数据库">linux高负载下彻底优化mysql数据库</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2010<br />
Source: <a href="http://www.linuxbyte.org/mysql-slave-pei-zhi-bei-fen.html">mysql slave 配置备份</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/mysql" rel="tag">mysql</a>, <a href="http://www.linuxbyte.org/tag/slave" rel="tag">slave</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/mysql" title="mysql" rel="tag">mysql</a>, <a href="http://www.linuxbyte.org/tag/slave" title="slave" rel="tag">slave</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/mysql-slave-pei-zhi-bei-fen.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

