<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.feedsky.com/styles/feedsky2.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/greytaro" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/greytaro" type="application/rss+xml"></fs:self_link><lastBuildDate>Tue, 10 Apr 2012 01:17:32 GMT</lastBuildDate><title>系统运维 | web2.0</title><description>分享最新的Web2.0网站，网络应用及互联网相关资讯以及记录与分享系统运维、系统架构、系统开发、SEO等相关技术知识。</description><link>http://www.jiunile.com</link><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><language>en</language><pubDate>Tue, 10 Apr 2012 01:20:10 GMT</pubDate><item><title>如何修改Cacti中rrd文件的大小</title><link>http://www.jiunile.com/%e5%a6%82%e4%bd%95%e4%bf%ae%e6%94%b9cacti%e4%b8%adrrd%e6%96%87%e4%bb%b6%e7%9a%84%e5%a4%a7%e5%b0%8f.html</link><content:encoded>&lt;p&gt;Cacti进行服务器监控时，5分钟的高精度数据默认只保留2天的数据记录，也就是说，两天以外的流量，我们就看不到5分钟的数据了。这对于我们现有的业务需求有所冲突，所以找了一些修改RRD保存周期的方法，可以对现有的RRD文件的保存周期进行修改。对于新建的rrd，可以通过 Data Source –&amp;gt; RRAs 中修改对应的 row，这样新建的数据，就默认使用新值。&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;注意：修改rrd尺寸的操作非常危险，在操作之前，备份您的rrd数据。本篇文章是个破坏你的rrd数据的最好机会。&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;strong&gt;方法一、&lt;/strong&gt;不通过命令行修改rrd的最简单的办法是使用The Toolsmith。这个工具有商业版和免费版，感兴趣的同学可以点击下面的链接试用一下。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;a href=&quot;http://www.thetoolsmith.com/&quot; target=&quot;_blank&quot;&gt;The Toolsmith&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;strong&gt;方法二、&lt;/strong&gt;下载&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/resize.pl_.gz&quot;&gt;resize.pl&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;是用来在命令行下修改rrd大小的工具，这个工具刚开始执行的时候，可能会提示一些perl模块的缺失。这个时候，一般只要按照提示进行安装就行了，我使用的是 perl –MCAPN –e shell 的方法。但是最后有一个提示找不到 RRDp.pm 的，这个在CPAN中找不到，需要下载安装 rrdtool-perl 的包，才能够提供这个模块。&lt;/p&gt;
&lt;p&gt;完成这些之后，就可以正常使用 resize.pl 了。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_001.png&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-1358&quot; title=&quot;cacti_001&quot; src=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_001-300x130.png&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;130&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;开始之前，可以先查看一下rrd文件的信息。使用下面的命令：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;perl resize.pl -f &amp;quot;/cacti/rra/test_rra_traffic_in_1563.rrd&amp;quot; -r 0 -o output_data/ -g 8000 -i&lt;/pre&gt;
&lt;p&gt;可以看到这个文件的详细信息&lt;br /&gt;
&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_002.png&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-1359&quot; title=&quot;cacti_002&quot; src=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_002-300x82.png&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;82&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
1、&lt;strong&gt;改变单个RRD中的RRA属性&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;最简单的办法就是把 –i 参数去掉就可以。&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;perl resize.pl -f &amp;quot;/cacti/rra/test_rra_traffic_in_1563.rrd&amp;quot; -r 0 -o output_data/ -g 8000&lt;/pre&gt;
&lt;p&gt;执行此命令后你将会看到如下输出：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;-- RRDTOOL RESIZE test_rra_traffic_in_1563.rrd RRA (0) growing 8000.. (95328).. RRA#0.. (159328).. Done.&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_003.png&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-1360&quot; title=&quot;cacti_003&quot; src=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_003-300x82.png&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;82&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
之后查看存放在 output_data 下的输出文件，可以看到rrd确实增长了。使用 –g 参数，表示将 row 的行数增长多少行。如果需要明确指定多少行，可以使用 –s 参数。2、&lt;strong&gt;改变单个RRD中的多个RRA&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;如果需要改变一个RRD中的多个RRA，可以使用下面的命令。&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
perl resize.pl -f &amp;quot;&amp;quot;/cacti/rra/test_rra_traffic_in_1563.rrd&amp;quot; /
            -r \u201c0 4 8 12\u201d /
            -o output_data/
            -g 8000
&lt;/pre&gt;
&lt;p&gt;执行后看到如下信息输出：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;-- RRDTOOL RESIZE test_rra_traffic_in_1563.rrd RRA (0 4 8 12) growing 8000.. (95328).. RRA#0#4#8#12.. (351328).. Done.&lt;/pre&gt;
&lt;p&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;即如下值的rra[0].cf、rra[4].cf、rra[8].cf、rra[12].cf改变了分别对应于AVERAGE, MIN, MAX, LAST&lt;/span&gt;：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
-- RRDTOOL INFO test_rra_traffic_in_1563.rrd ...
ds[uptime].type = &amp;quot;GAUGE&amp;quot;
rra[0].cf = &amp;quot;AVERAGE&amp;quot;
rra[0].rows = 600
rra[1].cf = &amp;quot;AVERAGE&amp;quot;
rra[1].rows = 700
rra[2].cf = &amp;quot;AVERAGE&amp;quot;
rra[2].rows = 775
rra[3].cf = &amp;quot;AVERAGE&amp;quot;
rra[3].rows = 797
rra[4].cf = &amp;quot;MIN&amp;quot;
rra[4].rows = 600
rra[5].cf = &amp;quot;MIN&amp;quot;
rra[5].rows = 700
rra[6].cf = &amp;quot;MIN&amp;quot;
rra[6].rows = 775
rra[7].cf = &amp;quot;MIN&amp;quot;
rra[7].rows = 797
rra[8].cf = &amp;quot;MAX&amp;quot;
rra[8].rows = 600
rra[9].cf = &amp;quot;MAX&amp;quot;
rra[9].rows = 700
rra[10].cf = &amp;quot;MAX&amp;quot;
rra[10].rows = 775
rra[11].cf = &amp;quot;MAX&amp;quot;
rra[11].rows = 797
rra[12].cf = &amp;quot;LAST&amp;quot;
rra[12].rows = 600
rra[13].cf = &amp;quot;LAST&amp;quot;
rra[13].rows = 700
rra[14].cf = &amp;quot;LAST&amp;quot;
rra[14].rows = 775
rra[15].cf = &amp;quot;LAST&amp;quot;
rra[15].rows = 797
&lt;/pre&gt;
&lt;p&gt;3、&lt;strong&gt;修改多个RRD中的多个RRA&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;resize.pl 在文件名参数中可以支持通配符，这样就可以非常方便的修改多个RRD文件。&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
perl resize.pl -f &amp;quot;original_data/tianjin_dpool_web_21_resize_rra_traffic_in_*.rrd&amp;quot; /
            -r \u201c0 4\u201d /
            -o output_data/
            -g 8000
&lt;/pre&gt;
&lt;p&gt;输出如下结果：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
-- RRDTOOL RESIZE tianjin_dpool_web_21_resize_rra_traffic_in_1569.rrd RRA (0 4) growing 8000.. (95328).. RRA#0#4.. (2045640).. Done.
-- RRDTOOL RESIZE tianjin_dpool_web_21_resize_rra_traffic_in_1570.rrd RRA (0 4) growing 8000.. (95328).. RRA#0#4.. (2045640).. Done.
-- RRDTOOL RESIZE tianjin_dpool_web_21_resize_rra_traffic_in_1571.rrd RRA (0 4) growing 8000.. (95328).. RRA#0#4.. (2045640).. Done.
......
&lt;/pre&gt;
&lt;p&gt;如图：&lt;br /&gt;
&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_004.png&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-1361&quot; title=&quot;cacti_004&quot; src=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_004-300x50.png&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;50&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/cacti_004.png&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;strong&gt;修改完成后查看rrd里的数据使用如下命令：&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;rrdtool fetch filename CF [--resolution|-r resolution] [--start|-s start] [--end|-e end] &lt;/pre&gt;
&lt;p&gt;其中 &amp;#8211;start、&amp;#8211;end、-r 都是可选的 。RRDtool 默认的 &amp;#8211;end 是 now ，&amp;#8211;start 是 end-1day ，也就是1天前。&lt;br /&gt;
CF 可以是 AVERAGE、MAX、MIN、LAST ，当然必须建库时有该 CF 类型的 RRA 才可以查，否则会报错。&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;

rrdtool fetch eth0.rrd AVERAGE --start 1164467700 --end 1164553800 |wc -l
&lt;/pre&gt;
&lt;p&gt;参考文献：&lt;/p&gt;
&lt;p&gt;http://www.cnblogs.com/cocowool/archive/2010/12/17/1909036.html&lt;/p&gt;
&lt;p&gt;http://docs.cacti.net/manual:088:8_rrdtool.04_resize#resize_rrd_files&lt;/p&gt;
&lt;p&gt;http://blog.gz72.net/post/4.html&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/625906882/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e5%a6%82%e4%bd%95%e4%bf%ae%e6%94%b9cacti%e4%b8%adrrd%e6%96%87%e4%bb%b6%e7%9a%84%e5%a4%a7%e5%b0%8f.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/%e5%a6%82%e4%bd%95%e4%bf%ae%e6%94%b9cacti%e4%b8%adrrd%e6%96%87%e4%bb%b6%e7%9a%84%e5%a4%a7%e5%b0%8f.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>Cacti进行服务器监控时，5分钟的高精度数据默认只保留2天的数据记录，也就是说，两天以外的流量，我们就看不到5分钟的数据了。这对于我们现有的业务需求有所冲突，所以找了一些修改RRD保存周期的方法，可以对现有的RRD文件的保存周期进行修改。对于新建的rrd，可以通过 Data Source –&gt; RRAs 中修改对应的 row，这样新建的数据，就默认使用新值。&lt;img src=&quot;http://www1.feedsky.com/t1/625906882/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e5%a6%82%e4%bd%95%e4%bf%ae%e6%94%b9cacti%e4%b8%adrrd%e6%96%87%e4%bb%b6%e7%9a%84%e5%a4%a7%e5%b0%8f.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Cacti</category><category>Cacti改变rrd大小</category><category>运维|运维监控</category><pubDate>Tue, 10 Apr 2012 09:17:32 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/%e5%a6%82%e4%bd%95%e4%bf%ae%e6%94%b9cacti%e4%b8%adrrd%e6%96%87%e4%bb%b6%e7%9a%84%e5%a4%a7%e5%b0%8f.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1356</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/%e5%a6%82%e4%bd%95%e4%bf%ae%e6%94%b9cacti%e4%b8%adrrd%e6%96%87%e4%bb%b6%e7%9a%84%e5%a4%a7%e5%b0%8f.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/625906882/6335187</fs:itemid></item><item><title>Qlnmp下载</title><link>http://www.jiunile.com/qlnmp%e4%b8%8b%e8%bd%bd.html</link><content:encoded>&lt;p&gt;Qlnmp2.0 是一个  Nginx + Mysql + PHP + Apche（可选）环境自动部署工具, 完全根据不同的硬件配置智能调优配置参数，包含安全证书双向验证的WEB管理工具、TLS + SSL 加密传输的FTP以及完全模块化选择的安装方式。适用于Redhat / Centos 5.x 32位和64位的操作系统。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;什么是 Qlnmp?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Qlnmp 是一个在Linux上使用源码编译和优化,并自动部署 Nginx+Mysql+PHP 环境的工具，并包含Apache (可选) 作为后端，处理动态文件,以及可扩展的PHP组件 (可选)，还有Pure-Ftp (可选) 服务以及一些管理工具，支持安装在32位和64位的Centos 5.X的系统上。&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;特性&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt;Qlnmp可以根据不同的硬件，智能写入不同的最佳参数的配置文件（精确到以每个CPU核心为最小单位，每32M内存为最小单位），并且不需要任何人为干预。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt;即使你不懂Linux或对Linux不熟悉，也没关系。Qlnmp可以很轻松的为你搭建需要的整个环境，并且提供一些便于管理的工具。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt;Qlnmp可以&lt;strong&gt;自动优化系统内核，网络性能，文件性能，防止轻型DDOS攻击&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt;Qlnmp使用Nginx作为前端处理静态文件，Apache作为后端处理动态文件，实现静态动态分离，也可以只使用Nginx处理全部文件。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5.&lt;/strong&gt;Qlnmp集成可选择的Pure-ftp作为FTP SERVER服务端，默认使用&lt;strong&gt;TLS连接+SSL证书加密通信&lt;/strong&gt;(强烈推存使用)，也可以将其一键转换成普通的FTP通信模式。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6.&lt;/strong&gt;Qlnmp支持lnmp (Linux Nginx MySql PHP) 与lnmpa (Linux Nginx MySql PHP Apache) 之间切换,支持ZendGuardLoader与Ioncube切换，并可附加memcached服务端组件，支持imagick图片加速功能。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;7.&lt;/strong&gt;Qlnmp包含3款PHP加速软件，APC、XCahce、eAccelerator； 并支持在3款PHP加速器之间切换 (APC、XCahce、eAccelerator)。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;8.&lt;/strong&gt;集成WEB管理工具：提供系统探针、PHP环境检查工具、3种不同的 Mysql Web 管理工具(PhpMyAdmin、MyWebMysql、SqlBuddy)可选、Ftp Web界面管理工具、Apache信息检查工具、Nginx状态检查工具、memcached服务功能检查工具、imagick图片加速功能检查工具。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;9.&lt;/strong&gt;所有的web管理页面都通过&lt;strong&gt;https和ssl协议&lt;/strong&gt;访问，并使用&lt;strong&gt;服务端和客户端证书双向验证&lt;/strong&gt;，增加了&lt;strong&gt;客户端证书导入密码验证&lt;/strong&gt;，&lt;strong&gt;加强了web管理登录的密码算法&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;10.&lt;/strong&gt;加入非常简易的快速创建WEB虚拟主机的工具，可以自定义错误页面； 以及一些小工具如： 证书部署工具、防火墙脚本、mysql帐户密码修复工具、FTP帐户密码修复工具、Web管理端帐户密码重新设置工具等。&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;包含组件:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Nginx&lt;/p&gt;
&lt;p&gt;Mysql&lt;/p&gt;
&lt;p&gt;PHP&lt;/p&gt;
&lt;p&gt;Apche&lt;/p&gt;
&lt;p&gt;ZendGuardLoader&lt;/p&gt;
&lt;p&gt;Ioncube&lt;/p&gt;
&lt;p&gt;eAccelerator&lt;/p&gt;
&lt;p&gt;APC&lt;/p&gt;
&lt;p&gt;XCache&lt;/p&gt;
&lt;p&gt;imagick&lt;/p&gt;
&lt;p&gt;ImageMagick&lt;/p&gt;
&lt;p&gt;memcache&lt;/p&gt;
&lt;p&gt;memcached&lt;/p&gt;
&lt;p&gt;pure-ftp&lt;/p&gt;
&lt;p&gt;pure-ftp web manager&lt;/p&gt;
&lt;p&gt;PhpMyAdmin&lt;/p&gt;
&lt;p&gt;MyWebSql&lt;/p&gt;
&lt;p&gt;SqlBuddy&lt;/p&gt;
&lt;p&gt;SSL certificate authentication&lt;/p&gt;
&lt;p&gt;Web management tools&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;版权&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Qlnmp所有版权和代码遵循GPL协议。你可以自由的下载、复制、修改和传播。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;更多信息，请查看Qlnmp官网：&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://qlnmp.openfans.org/&quot;&gt;http://qlnmp.openfans.org&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;软件部分截图：&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/image1.png&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-1352&quot; title=&quot;image1&quot; src=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/image1-300x209.png&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;209&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/image2.png&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-1353&quot; title=&quot;image2&quot; src=&quot;http://www.jiunile.com/wp-content/uploads/2012/04/image2-300x212.png&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;212&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/624711309/greytaro/feedsky/s.gif?r=http://www.jiunile.com/qlnmp%e4%b8%8b%e8%bd%bd.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/qlnmp%e4%b8%8b%e8%bd%bd.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>Qlnmp2.0 是一个  Nginx + Mysql + PHP + Apche（可选）环境自动部署工具, 完全根据不同的硬件配置智能调优配置参数，包含安全证书双向验证的WEB管理工具、TLS + SSL 加密传输的FTP以及完全模块化选择的安装方式。适用于Redhat / Centos 5.x 32位和64位的操作系统。&lt;img src=&quot;http://www1.feedsky.com/t1/624711309/greytaro/feedsky/s.gif?r=http://www.jiunile.com/qlnmp%e4%b8%8b%e8%bd%bd.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>运维|APPServer</category><category>qlnmp</category><category>运维|学习分享</category><pubDate>Fri, 06 Apr 2012 11:14:54 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/qlnmp%e4%b8%8b%e8%bd%bd.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1351</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/qlnmp%e4%b8%8b%e8%bd%bd.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/624711309/6335187</fs:itemid></item><item><title>[转]常见的nginx的配置选项</title><link>http://www.jiunile.com/%e8%bd%ac%e5%b8%b8%e8%a7%81%e7%9a%84nginx%e7%9a%84%e9%85%8d%e7%bd%ae%e9%80%89%e9%a1%b9.html</link><content:encoded>&lt;p&gt;原地址是:&lt;a href=&quot;http://agiletesting.blogspot.jp/2010/06/commong-nginx-configuration-options.html&quot;&gt;http://agiletesting.blogspot.jp/2010/06/commong-nginx-configuration-options.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Google 上有丰富的 Nginx 的教程和样本配置文件，但很多时候时候，配置这些是一些技巧，一直对大家很有帮助。&lt;/p&gt;
&lt;h2&gt;Include 文件&lt;/h2&gt;
&lt;p&gt;不要在您的主 nginx.conf 文件中配置所有的东西,你需要分成几个较小的文件。您的同事会很感激你的。比如我的结构,我定义我的 upstream 的 pool 的为一个文件，和一个文件定义 location 处理服务器上其它的应用。&lt;/p&gt;
&lt;p&gt;例子：&lt;br /&gt;
upstreams.conf&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
upstream cluster1 {
    fair;
    server app01:7060;
    server app01:7061;
    server app02:7060;
    server app02:7061;
}

upstream cluster2 {
    fair;
    server app01:7071;
    server app01:7072;
    server app02:7071;
    server app02:7072;
}
&lt;/pre&gt;
&lt;p&gt;locations.conf&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
location / {
    root /var/www;
    include cache-control.conf;
    index index.html index.htm;
}

location /services/service1 {
    proxy_pass_header Server;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Scheme $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    add_header Pragma &amp;quot;no-cache&amp;quot;;

    proxy_pass http://cluster1/;
}

location /services/service2 {
    proxy_pass_header Server;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Scheme $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    add_header Pragma &amp;quot;no-cache&amp;quot;;

    proxy_pass http://cluster2/service2;
}
&lt;/pre&gt;
&lt;p&gt;servers.conf&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
server {
    listen 80;
    include locations.conf;
}
&lt;/pre&gt;
&lt;p&gt;现在，你的 nginx.conf 看起来非常的干净和简单（仍然可以分开更多,来更包括文件，比如分离gzip的配置选项)&lt;/p&gt;
&lt;p&gt;nginx.conf&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
worker_processes 4;
worker_rlimit_nofile 10240;

events {
    worker_connections 10240;
    use epoll;
}

http {
    include upstreams.conf;

    include mime.types;
    default_type application/octet-stream;

    log_format custom '$remote_addr - $remote_user [$time_local] '
        '&amp;quot;$request&amp;quot; $status $bytes_sent '
        '&amp;quot;$http_referer&amp;quot; &amp;quot;$http_user_agent&amp;quot; &amp;quot;$http_x_forwarded_for&amp;quot; $request_time';

    access_log /usr/local/nginx/logs/access.log custom;

    proxy_buffering off;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

    gzip on;
    gzip_min_length 10240;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/xml+rss image/svg+xml application/x-font-ttf application/vnd.ms-fontobject;
    gzip_disable &amp;quot;MSIE [1-6]\.&amp;quot;;

    # proxy cache config
    proxy_cache_path /mnt/nginx_cache levels=1:2
    keys_zone=one:10m
    inactive=7d max_size=10g;
    proxy_temp_path /var/tmp/nginx_temp;

    proxy_next_upstream error;

    include servers.conf;
&lt;/pre&gt;
&lt;p&gt;这 nginx.conf 文件是使用了一些不太常见的配置选项，它值得指出其中一些重要的。&lt;/p&gt;
&lt;h2&gt;多个 worker  的配置(进程)&lt;/h2&gt;
&lt;p&gt;如果你的 Nginx 是多个 CPU 和多核,需要配置成多核的数量比较好:&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
worker_processes 4;
&lt;/pre&gt;
&lt;h2&gt;增加打开的文件句柄&lt;/h2&gt;
&lt;p&gt;如果 Nginx 服务很大的流量,增加最大可以打开的文件句柄还是很有用的,因为默认只有 1024 个.可以使用 &amp;#8216;ulimit -n&amp;#8217; 看到当前系统中的设置.&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;worker_rlimit_nofile 10240;&lt;/pre&gt;
&lt;h2&gt;定制的日志&lt;/h2&gt;
&lt;p&gt;可以看看 log_format 和 access_log 二个选项的设置. 通常我们有几个参数最常使用,象 &amp;#8220;$http_x_forwarded_for&amp;#8221; 可以见到 load balancer 的设备之前的 IP, 还有 &amp;#8220;$request_time&amp;#8221; 可以见到 Nginx 来处理这个主动所花的时间.&lt;/p&gt;
&lt;h2&gt;压缩&lt;/h2&gt;
&lt;p&gt;压缩对于文本非常非常的有用.&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/xml+rss image/svg+xml application/x-font-ttf application/vnd.ms-fontobject;
gzip_disable &amp;quot;MSIE [1-6]\.&amp;quot;;
&lt;/pre&gt;
&lt;h2&gt;代理的选项&lt;/h2&gt;
&lt;p&gt;这些选项可以在每个 location 中设置.&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Pragma &amp;quot;no-cache&amp;quot;;
&lt;/pre&gt;
&lt;p&gt;这个中加了一个定制的参数,就是 &amp;#8216;no-cache&amp;#8217;,这样就不会使用 cache 的内容了.&lt;/p&gt;
&lt;h2&gt;代理的 Cache&lt;/h2&gt;
&lt;p&gt;使用 Nginx 可以给一些文件来 cache 到本地来当 Cache 的服务器,需要设置  proxy_cache_path 和  proxy_temp_path  在你的 HTTP 的 directive 中.在 location 中配置.如果有你想 cache 的内容的话.&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
proxy_cache_path /mnt/nginx_cache levels=1:2
keys_zone=one:10m
inactive=7d max_size=10g;
proxy_temp_path /var/tmp/nginx_temp;
&lt;/pre&gt;
&lt;p&gt;这可能还想增加一些其它的参数&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
proxy_cache one;
proxy_cache_key mylocation.$request_uri;
proxy_cache_valid 200 302 304 10m;
proxy_cache_valid 301 1h;
proxy_cache_valid any 1m;
proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
&lt;/pre&gt;
&lt;h2&gt;HTTP caching options&lt;/h2&gt;
&lt;p&gt;有时你想使用其它的东西来做 Cache ,你可能需要指定怎么样 cache. 你可以给 cache 的信息的文件 include 到你的 root 的 location 中:&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
location / {
    root /var/www;
    include cache-control.conf;

    index index.html index.htm;
}
&lt;/pre&gt;
&lt;p&gt;你可以指定不同的头到于不同的文件&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
# default cache 1 day
expires +1d;

if ($request_uri ~* &amp;quot;^/services/.*$&amp;quot;) {
    expires +0d;
    add_header Pragma &amp;quot;no-cache&amp;quot;;
}

if ($request_uri ~* &amp;quot;^/(index.html)?$&amp;quot;) {
    expires +1h;
}
&lt;/pre&gt;
&lt;h2&gt;SSL&lt;/h2&gt;
&lt;p&gt;如果你要配置 ssl 的连接的话&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;

server {
    server_name www.example.com;
    listen 443;
    ssl on;
    ssl_certificate /usr/local/nginx/ssl/cert.pem;
    ssl_certificate_key /usr/local/nginx/ssl/cert.key;

    include locations.conf;
}
&lt;/pre&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/623273434/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e8%bd%ac%e5%b8%b8%e8%a7%81%e7%9a%84nginx%e7%9a%84%e9%85%8d%e7%bd%ae%e9%80%89%e9%a1%b9.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/%e8%bd%ac%e5%b8%b8%e8%a7%81%e7%9a%84nginx%e7%9a%84%e9%85%8d%e7%bd%ae%e9%80%89%e9%a1%b9.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>常见的nginx的配置选项&lt;img src=&quot;http://www1.feedsky.com/t1/623273434/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e8%bd%ac%e5%b8%b8%e8%a7%81%e7%9a%84nginx%e7%9a%84%e9%85%8d%e7%bd%ae%e9%80%89%e9%a1%b9.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>nginx常见配置</category><category>运维|APPServer</category><pubDate>Sun, 01 Apr 2012 19:09:41 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/%e8%bd%ac%e5%b8%b8%e8%a7%81%e7%9a%84nginx%e7%9a%84%e9%85%8d%e7%bd%ae%e9%80%89%e9%a1%b9.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1348</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/%e8%bd%ac%e5%b8%b8%e8%a7%81%e7%9a%84nginx%e7%9a%84%e9%85%8d%e7%bd%ae%e9%80%89%e9%a1%b9.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/623273434/6335187</fs:itemid></item><item><title>[转]为什么服务器上，我们要使用 CentOS</title><link>http://www.jiunile.com/%e8%bd%ac%e4%b8%ba%e4%bb%80%e4%b9%88%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%ef%bc%8c%e6%88%91%e4%bb%ac%e8%a6%81%e4%bd%bf%e7%94%a8-centos.html</link><content:encoded>&lt;p&gt;早期，我们使用 Debian 作为服务器软件，后来转向了CentOS，主要原因如下：&lt;/p&gt;
&lt;p&gt;1、CentOS/RHEL的生命周期是7年，基本上可以覆盖硬件的生命周期，也就意味着一个新硬件安装以后，不用再次安装操作系统。要知道重新折腾一个生产机是很麻烦而且有风险的事情。&lt;/p&gt;
&lt;p&gt;[2012.2.1]今天刚刚收到红帽子的通知邮件，RedHat 5, RedHat 6的生命周期，延长到10年，太牛叉了。这个对企业用户很重要。&lt;/p&gt;
&lt;p&gt;而Debian的生命周期是不固定的，一般新版本发布以后，上个版本再维护18个月。而Debian的版本发布时间间隔不稳定，经常会延期。综合起来一个版本的生命周期一般在3～4年。&lt;/p&gt;
&lt;p&gt;Ubuntu的server版生命周期是5年。&lt;/p&gt;
&lt;p&gt;如果你选用了 Debian 或者 Ubuntu作为服务器，等生命周期过了以后，就没有安全补丁，你的服务器就会裸奔或者需要重新安装系统。&lt;/p&gt;
&lt;p&gt;2、CentOS/RHEL对硬件的支持很好，主流硬件厂商早就将服务器拿过去测试，一般不存在硬件的兼容性问题。&lt;/p&gt;
&lt;p&gt;而Debian就麻烦了，由于有版权上的考虑和代码纯洁性上的洁癖，一些硬件驱动和软件被删掉了，导致安装过程有问题。比如 Dell 服务器上，大量使用的网卡 BroadCom，就驱动不了，安装了以后，网络起不来。&lt;/p&gt;
&lt;p&gt;3、大量商业软件，比如 Oracle ，都是针对 Redhat认证的，有大量的帮助文档和使用说明，有良好的技术支持。&lt;/p&gt;
&lt;p&gt;4、CentOS 是RedHat的克隆版，如果需要可以随时平滑切换到 RedHat，从而享受RedHat的服务支持。RedHat是一个值得尊敬的开源公司，有很多大牛，Linux内核他们的贡献程度最多。是要知道厂商的服务，是最后一道防火墙，如果你给一个大客户做方案，他们一般会倾向选用商业服务。万一出了什么问题，还有Redhat可以求助，或者有一个RedHat可以承担责任 &lt;img src=&quot;http://www.pubyun.com/blog/wp-includes/images/smilies/icon_smile.gif&quot; alt=&quot;:-)&quot; /&gt;&lt;br /&gt;
5、熟悉了 CentOS/RedHat ，找工作更加容易&lt;/p&gt;
&lt;p&gt;6、CentOS/RHEL 的批量安装更加方便&lt;/p&gt;
&lt;p&gt;在机房，使用kickstart + PXE安装，给客户，使用定制的kickstart光盘，一键安装，一般在5分钟左右就可以安装完。而debian的preseed 本质上是按照步骤模拟手工操作一点一点来配置，相对 kickstart，配置文件更加复杂。比如做 softraid + LVM，是目前最常用的一个磁盘分区分案，使用 preseed很麻烦，而 kickstart 简洁。&lt;/p&gt;
&lt;p&gt;来自http://www.pubyun.com/blog/?p=77&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/623273435/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e8%bd%ac%e4%b8%ba%e4%bb%80%e4%b9%88%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%ef%bc%8c%e6%88%91%e4%bb%ac%e8%a6%81%e4%bd%bf%e7%94%a8-centos.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/%e8%bd%ac%e4%b8%ba%e4%bb%80%e4%b9%88%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%ef%bc%8c%e6%88%91%e4%bb%ac%e8%a6%81%e4%bd%bf%e7%94%a8-centos.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>为什么服务器上，我们要使用 CentOS&lt;img src=&quot;http://www1.feedsky.com/t1/623273435/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e8%bd%ac%e4%b8%ba%e4%bb%80%e4%b9%88%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%ef%bc%8c%e6%88%91%e4%bb%ac%e8%a6%81%e4%bd%bf%e7%94%a8-centos.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>centos</category><category>运维|学习分享</category><pubDate>Fri, 23 Mar 2012 19:49:40 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/%e8%bd%ac%e4%b8%ba%e4%bb%80%e4%b9%88%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%ef%bc%8c%e6%88%91%e4%bb%ac%e8%a6%81%e4%bd%bf%e7%94%a8-centos.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1342</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/%e8%bd%ac%e4%b8%ba%e4%bb%80%e4%b9%88%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%ef%bc%8c%e6%88%91%e4%bb%ac%e8%a6%81%e4%bd%bf%e7%94%a8-centos.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/623273435/6335187</fs:itemid></item><item><title>wordpress生成静态页面插件cos-html-cache</title><link>http://www.jiunile.com/wordpress%e7%94%9f%e6%88%90%e9%9d%99%e6%80%81%e9%a1%b5%e9%9d%a2%e6%8f%92%e4%bb%b6cos-html-cache.html</link><content:encoded>&lt;h3&gt;WordPress静态化插件cos-html-cache&lt;/h3&gt;
&lt;p&gt;博客建好后，接下来就要填充内容、优化博客，进而提高博客访客体验度，体验度的提高，那么对网站速度的提高也变得尤为重要，给网站提速有很多方法，各种静态化插件都是非常不错的，让博客主页和内容页都生成静态html文件，也是加快访问速度的一种技巧！&lt;/p&gt;
&lt;p&gt;cos-html-cache 插件是国内站长开发的，使用比较方便，该插件会在页面第一次载入的时候产生和url对应的真正的html文件作为缓存，后面的运行将会直接载入该html 从而大大的提高了页面的效率。当页面内容发生变化时将会自动更新对应的页面，更新缓存的触发事件有：修改文章、删除文章、评论成功提交，同时这些事件也将会更新与之相邻的文章。&lt;/p&gt;
&lt;p&gt;安装非常简单：&lt;/p&gt;
&lt;p&gt;1.登录博客后台&lt;/p&gt;
&lt;p&gt;2.添加插件&lt;/p&gt;
&lt;p&gt;3.搜索cos-html-cache&lt;/p&gt;
&lt;p&gt;4.安装启用即可&lt;/p&gt;
&lt;p&gt;完成！&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/623273436/greytaro/feedsky/s.gif?r=http://www.jiunile.com/wordpress%e7%94%9f%e6%88%90%e9%9d%99%e6%80%81%e9%a1%b5%e9%9d%a2%e6%8f%92%e4%bb%b6cos-html-cache.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/wordpress%e7%94%9f%e6%88%90%e9%9d%99%e6%80%81%e9%a1%b5%e9%9d%a2%e6%8f%92%e4%bb%b6cos-html-cache.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>wordpress生成静态页面插件cos-html-cache&lt;img src=&quot;http://www1.feedsky.com/t1/623273436/greytaro/feedsky/s.gif?r=http://www.jiunile.com/wordpress%e7%94%9f%e6%88%90%e9%9d%99%e6%80%81%e9%a1%b5%e9%9d%a2%e6%8f%92%e4%bb%b6cos-html-cache.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>wordpress插件</category><category>cos-html-cache</category><category>运维|学习分享</category><pubDate>Thu, 15 Mar 2012 16:50:18 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/wordpress%e7%94%9f%e6%88%90%e9%9d%99%e6%80%81%e9%a1%b5%e9%9d%a2%e6%8f%92%e4%bb%b6cos-html-cache.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1340</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/wordpress%e7%94%9f%e6%88%90%e9%9d%99%e6%80%81%e9%a1%b5%e9%9d%a2%e6%8f%92%e4%bb%b6cos-html-cache.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/623273436/6335187</fs:itemid></item><item><title>lnmp环境运行python</title><link>http://www.jiunile.com/lnmp%e7%8e%af%e5%a2%83%e8%bf%90%e8%a1%8cpython.html</link><content:encoded>&lt;h2&gt;&lt;strong&gt;简介&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;由于一些业务的需要，需要用python来编写一些api接口，为了能快速的开发python程序，需要选择一种框架能快速的实现python程序。目前已有的python框架有：&lt;a href=&quot;http://sebug.net/paper/books/tornado/#overview&quot; target=&quot;_blank&quot;&gt;tornado&lt;/a&gt;、&lt;a href=&quot;http://djangobook.py3k.cn/2.0/&quot; target=&quot;_blank&quot;&gt;django&lt;/a&gt;、&lt;a href=&quot;http://flask.flyzen.com/quickstart/&quot; target=&quot;_blank&quot;&gt;flask&lt;/a&gt;、&lt;a href=&quot;http://webpy.org/cookbook/index.zh-cn&quot; target=&quot;_blank&quot;&gt;web.py&lt;/a&gt;等等。基于以上框架，我选择了web.py来实现我的api接口。原因是web.py比较小巧，安装配置起来非常方便。&lt;/p&gt;
&lt;h2&gt;安装配置Python&lt;/h2&gt;
&lt;p&gt;1.首先安装python2.7.2&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2
tar jxvf Python2.7.2.tar.bz2
cd Python2.7.2
./configure
make &amp;amp;&amp;amp; make install
#自此,python2.7安装后路径默认是在/usr/local/lib/python2.7
ln -s /usr/local/bin/python2.7 /usr/bin/python
python -V
&lt;/pre&gt;
&lt;p&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;需要注意的是yum使用的python2.4.* 此时python升级到2.7.*将导致yum不可用。&lt;/span&gt;&lt;br /&gt;
解决方法：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
vi /usr/bin/yum
将#/usr/bin/python修改为#/usr/bin/python2.4
&lt;/pre&gt;
&lt;p&gt;2.安装setuptools来使用easy_install命令安装所需扩展&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install
vim ~/.bashrc
增加export PATH=$PATH:/usr/local/bin
&lt;/pre&gt;
&lt;p&gt;3.安装mysqldb和web.py&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
easy_install MySQLdb
easy_install web.py
&lt;/pre&gt;
&lt;h2&gt;在lnmp环境中配置运行python&lt;/h2&gt;
&lt;p&gt;python可以使用fcgi和wsgi模块来运行python，但都比较麻烦，这里我使用uWSGI，uWSGI，既不用wsgi协议也不用fcgi协议，而是自创了一个uwsgi的协议，据说该协议大约是fcgi协议的10倍那么快。有个比较见下图：&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/03/0946000.jpg&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-medium wp-image-1332&quot; title=&quot;0946000&quot; src=&quot;http://www.jiunile.com/wp-content/uploads/2012/03/0946000-300x263.jpg&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;263&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;uWSGI的主要特点如下：&lt;/p&gt;
&lt;p&gt;◆超快的性能。&lt;/p&gt;
&lt;p&gt;◆低内存占用（实测为apache2的mod_wsgi的一半左右）。&lt;/p&gt;
&lt;p&gt;◆多app管理。&lt;/p&gt;
&lt;p&gt;◆详尽的日志功能（可以用来分析app性能和瓶颈）。&lt;/p&gt;
&lt;p&gt;◆高度可定制（内存大小限制，服务一定次数后重启等）。&lt;/p&gt;
&lt;p&gt;1.安装uwsgi&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;easy_install uwsgi&lt;/pre&gt;
&lt;p&gt;2.为uwsgi配置多个站点&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
easy_install virtualenv
#然后设置一个/多个app基准环境：
virtualenv /var/www/myapp
#应用环境，在此环境下安装的软件仅在此环境下有效：
source /var/www/myapp/bin/activate
pip install django
pip install mako
pip install web.py
pip install mysql-python
...
&lt;/pre&gt;
&lt;p&gt;3.配置nginx&lt;br /&gt;
最后配置nginx，注意每个站点必须单独占用一个server&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
  server {
        listen       82;
        server_name  _;
        location / {
                include uwsgi_params;
                uwsgi_pass 127.0.0.1:9091;
                uwsgi_param UWSGI_PYHOME /var/www/myapp;
                uwsgi_param UWSGI_SCRIPT code;#入口脚本
                uwsgi_param UWSGI_CHDIR /var/www/myapp/example;#指程序所在的目录
        }
        location /static/{
            root /var/www/myapp/example/;
        }                                                                                                                              

    }
&lt;/pre&gt;
&lt;p&gt;4.uwsgi的参数&lt;br /&gt;
并发4个线程：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;uwsgi -s :9090 -w myapp -p 4 &lt;/pre&gt;
&lt;p&gt;主控制线程+4个线程：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;uwsgi -s :9090 -w myapp -M -p 4 &lt;/pre&gt;
&lt;p&gt;执行超过30秒的client直接放弃：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;uwsgi -s :9090 -w myapp -M -p 4 -t 30&lt;/pre&gt;
&lt;p&gt;限制内存空间128M：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;uwsgi -s :9090 -w myapp -M -p 4 -t 30 --limit-as 128 &lt;/pre&gt;
&lt;p&gt;服务超过10000个req自动respawn：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;uwsgi -s :9090 -w myapp -M -p 4 -t 30 --limit-as 128 -R 10000&lt;/pre&gt;
&lt;p&gt;后台运行等：&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;uwsgi -s :9090 -w myapp -M -p 4 -t 30 --limit-as 128 -R 10000 -d /path/to/uwsgi.log &lt;/pre&gt;
&lt;p&gt;为了让多个站点共享一个uwsgi服务，必须把uwsgi运行成虚拟站点：去掉“-w myapp”加上”–vhost”&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;uwsgi -s :9090 -M -p 4 -t 30 --limit-as 128 -R 10000 -d /path/to/uwsgi.log --vhost &lt;/pre&gt;
&lt;p&gt;5.启动运行示例&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
cd /var/www/myapp
mkdir myappdir1
vi test.py
#!/usr/bin/env python
# coding:utf-8
import web
urls = (
    '/(.*)', 'hello'
)
app = web.application(urls, globals())

class hello:
    def GET(self, name):
        if not name:
            name = 'World'
        return 'Hello, ' + name + '!'

application = app.wsgifunc()
&lt;/pre&gt;
&lt;p&gt;启动服务&amp;amp;&amp;amp;访问&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
service nginx restart
uwsgi -s :9090 -M -p 4 -t 30 --limit-as 128 -R 10000 -d /path/to/uwsgi.log --vhost

http://ip:81/xiaoming
&lt;/pre&gt;
&lt;h2&gt;问题列表&lt;/h2&gt;
&lt;p&gt;1.502 Bad Gateway&lt;/p&gt;
&lt;p&gt;没有启动uwsgi服务，使用命令查看是否启动&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;netstat -antp | grep &amp;quot;uwsgi&amp;quot;&lt;/pre&gt;
&lt;p&gt;2.cannot allocate memory&lt;br /&gt;
可能是我虚拟机运行的缘故，导致出现此类错误。解决方法在启动uwsgi的时候去掉&amp;#8211;limit-as 128&lt;/p&gt;
&lt;p&gt;3.多次刷新出现拒绝服务问题&lt;br /&gt;
使用tcpdump抓包分析&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
tcpdump -i eth0 -nn port 81 -X
#tcpdump 監聽 (1)來自 eth0 介面卡且 (2)通訊協定為 port 22 ，(3)目標來源為 192.168.1.100 的封包資料
tcpdump -i eth0 -nn 'port 22 and src host 192.168.1.100'
&lt;/pre&gt;
&lt;p&gt;4.实用web.py静态资源无法访问到，解决方法&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
nginx:
        location /static/{
            root /var/www/myapp/example/;
        }
apache:
&amp;lt;VirtualHost *:80&amp;gt;
    ServerName example.com:80
    DocumentRoot /doc/root/
    # mounts your application if mod_wsgi is being used
    WSGIScriptAlias / /script/root/code.py
    # the Alias directive
    Alias /static /doc/root/static

    &amp;lt;Directory /&amp;gt;
        Order Allow,Deny
        Allow From All
        Options -Indexes
    &amp;lt;/Directory&amp;gt;

    # because Alias can be used to reference resources outside docroot, you
    # must reference the directory with an absolute path
    &amp;lt;Directory /doc/root/static&amp;gt;
        # directives to effect the static directory
        Options +Indexes
    &amp;lt;/Directory&amp;gt;
&amp;lt;/VirtualHost&amp;gt;
&lt;/pre&gt;
&lt;p&gt;参考网站：&lt;/p&gt;
&lt;p&gt;http://projects.unbit.it/uwsgi/wiki/Example&lt;/p&gt;
&lt;p&gt;http://projects.unbit.it/uwsgi/wiki/Doc&lt;/p&gt;
&lt;p&gt;http://projects.unbit.it/uwsgi/wiki/Decorators&lt;/p&gt;
&lt;p&gt;http://blog.csdn.net/yeqihong/article/details/1477050&lt;/p&gt;
&lt;p&gt;http://developer.51cto.com/art/201010/229615.htm&lt;/p&gt;
&lt;p&gt;感谢我师傅(喜碧)以及晖哥的帮助～&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/623273437/greytaro/feedsky/s.gif?r=http://www.jiunile.com/lnmp%e7%8e%af%e5%a2%83%e8%bf%90%e8%a1%8cpython.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/lnmp%e7%8e%af%e5%a2%83%e8%bf%90%e8%a1%8cpython.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>lnmp环境配置运行python实例&lt;img src=&quot;http://www1.feedsky.com/t1/623273437/greytaro/feedsky/s.gif?r=http://www.jiunile.com/lnmp%e7%8e%af%e5%a2%83%e8%bf%90%e8%a1%8cpython.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>python</category><category>运维|APPServer</category><category>uwsgi</category><category>lnmp</category><category>运维|学习分享</category><category>运维|语言</category><pubDate>Thu, 15 Mar 2012 11:43:01 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/lnmp%e7%8e%af%e5%a2%83%e8%bf%90%e8%a1%8cpython.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1330</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/lnmp%e7%8e%af%e5%a2%83%e8%bf%90%e8%a1%8cpython.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/623273437/6335187</fs:itemid></item><item><title>每日更新的电信IP段，联通IP段，铁通IP段和移动IP段</title><link>http://www.jiunile.com/%e6%af%8f%e6%97%a5%e6%9b%b4%e6%96%b0%e7%9a%84%e7%94%b5%e4%bf%a1ip%e6%ae%b5%ef%bc%8c%e8%81%94%e9%80%9aip%e6%ae%b5%ef%bc%8c%e9%93%81%e9%80%9aip%e6%ae%b5%e5%92%8c%e7%a7%bb%e5%8a%a8ip%e6%ae%b5.html</link><content:encoded>&lt;p&gt;联通静态路由IP,电信静态路由IP&lt;/p&gt;
&lt;p&gt;根据APNIC的最新IP地址列表及whois信息，每日0点（UTC时区）生成的各主要运营商IP地址段，准确度还是很高的。&lt;/p&gt;
&lt;p&gt;中国电信IP地址段： &lt;a href=&quot;http://files.liubaishui.com/ChinaTelcom.txt&quot; target=&quot;_blank&quot;&gt;http://files.liubaishui.com/ChinaTelcom.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;中国联通（网通）IP地址段 &lt;a href=&quot;http://files.liubaishui.com/UNICOM_CNC.txt&quot; target=&quot;_blank&quot;&gt;http://files.liubaishui.com/UNICOM_CNC.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;中国铁通IP地址段 &lt;a href=&quot;http://files.liubaishui.com/CTT.txt&quot; target=&quot;_blank&quot;&gt;http://files.liubaishui.com/CTT.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;中国移动IP地址段 &lt;a href=&quot;http://files.liubaishui.com/CMCC.txt&quot; target=&quot;_blank&quot;&gt;http://files.liubaishui.com/CMCC.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;来自http://liubaishui.com/&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/623273438/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e6%af%8f%e6%97%a5%e6%9b%b4%e6%96%b0%e7%9a%84%e7%94%b5%e4%bf%a1ip%e6%ae%b5%ef%bc%8c%e8%81%94%e9%80%9aip%e6%ae%b5%ef%bc%8c%e9%93%81%e9%80%9aip%e6%ae%b5%e5%92%8c%e7%a7%bb%e5%8a%a8ip%e6%ae%b5.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/%e6%af%8f%e6%97%a5%e6%9b%b4%e6%96%b0%e7%9a%84%e7%94%b5%e4%bf%a1ip%e6%ae%b5%ef%bc%8c%e8%81%94%e9%80%9aip%e6%ae%b5%ef%bc%8c%e9%93%81%e9%80%9aip%e6%ae%b5%e5%92%8c%e7%a7%bb%e5%8a%a8ip%e6%ae%b5.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>每日更新的电信IP段，联通IP段，铁通IP段和移动IP段&lt;img src=&quot;http://www1.feedsky.com/t1/623273438/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e6%af%8f%e6%97%a5%e6%9b%b4%e6%96%b0%e7%9a%84%e7%94%b5%e4%bf%a1ip%e6%ae%b5%ef%bc%8c%e8%81%94%e9%80%9aip%e6%ae%b5%ef%bc%8c%e9%93%81%e9%80%9aip%e6%ae%b5%e5%92%8c%e7%a7%bb%e5%8a%a8ip%e6%ae%b5.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>IP段</category><category>运维|学习分享</category><pubDate>Tue, 28 Feb 2012 11:32:09 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/%e6%af%8f%e6%97%a5%e6%9b%b4%e6%96%b0%e7%9a%84%e7%94%b5%e4%bf%a1ip%e6%ae%b5%ef%bc%8c%e8%81%94%e9%80%9aip%e6%ae%b5%ef%bc%8c%e9%93%81%e9%80%9aip%e6%ae%b5%e5%92%8c%e7%a7%bb%e5%8a%a8ip%e6%ae%b5.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1327</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/%e6%af%8f%e6%97%a5%e6%9b%b4%e6%96%b0%e7%9a%84%e7%94%b5%e4%bf%a1ip%e6%ae%b5%ef%bc%8c%e8%81%94%e9%80%9aip%e6%ae%b5%ef%bc%8c%e9%93%81%e9%80%9aip%e6%ae%b5%e5%92%8c%e7%a7%bb%e5%8a%a8ip%e6%ae%b5.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/623273438/6335187</fs:itemid></item><item><title>[转载]centos yum只更新安全补丁</title><link>http://www.jiunile.com/%e8%bd%ac%e8%bd%bdcentos-yum%e5%8f%aa%e6%9b%b4%e6%96%b0%e5%ae%89%e5%85%a8%e8%a1%a5%e4%b8%81.html</link><content:encoded>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;安装yum插件即可:&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;yum install yum-security&lt;/pre&gt;
&lt;p&gt;使用:&lt;br /&gt;
检查安全更新&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;yum --security check-update&lt;/pre&gt;
&lt;p&gt;只安装安全更新&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;yum update --security&lt;/pre&gt;
&lt;p&gt;检查特定软件有无安全更新&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;yum list-security software_name&lt;/pre&gt;
&lt;p&gt;列出更新的详细信息&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;yum info-security software_name&lt;/pre&gt;
&lt;p&gt;来源：http://www.ppkj.net&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/623273439/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e8%bd%ac%e8%bd%bdcentos-yum%e5%8f%aa%e6%9b%b4%e6%96%b0%e5%ae%89%e5%85%a8%e8%a1%a5%e4%b8%81.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/%e8%bd%ac%e8%bd%bdcentos-yum%e5%8f%aa%e6%9b%b4%e6%96%b0%e5%ae%89%e5%85%a8%e8%a1%a5%e4%b8%81.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>&amp;#160; 安装yum插件即可: 使用: 检查安全更新 只安装安全更新 检查特定软件有无安全更新 列出更新的详细信息 来源：http://www.ppkj.net&lt;img src=&quot;http://www1.feedsky.com/t1/623273439/greytaro/feedsky/s.gif?r=http://www.jiunile.com/%e8%bd%ac%e8%bd%bdcentos-yum%e5%8f%aa%e6%9b%b4%e6%96%b0%e5%ae%89%e5%85%a8%e8%a1%a5%e4%b8%81.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>运维|APPServer</category><category>cetos yum 只更新安全补丁</category><pubDate>Thu, 23 Feb 2012 17:15:52 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/%e8%bd%ac%e8%bd%bdcentos-yum%e5%8f%aa%e6%9b%b4%e6%96%b0%e5%ae%89%e5%85%a8%e8%a1%a5%e4%b8%81.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1323</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/%e8%bd%ac%e8%bd%bdcentos-yum%e5%8f%aa%e6%9b%b4%e6%96%b0%e5%ae%89%e5%85%a8%e8%a1%a5%e4%b8%81.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/623273439/6335187</fs:itemid></item><item><title>Apache2.4.1 安装配置过程</title><link>http://www.jiunile.com/http2-4-1-%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%bf%87%e7%a8%8b.html</link><content:encoded>&lt;p&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&lt;strong&gt;【注意事项】&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;1.http2.2.* 不能直接升级到2.4.1,需要先停止apache，将http.conf 改名成http.conf-2.2.*&lt;/p&gt;
&lt;p&gt;2.http2.4.1 目前不再支持php5.2.* 可用的php为5.3.10&lt;/p&gt;
&lt;p&gt;php5.2* 会报 httpd: Syntax error on line 163 of httpd.conf: Cannot load modules/libphp5.so into server: modules/libphp5.so: undefined symbol: unixd_config&lt;/p&gt;
&lt;p&gt;3.http2.4.1 不在需要NameVirtualHost以及不再支持ServerName * 这种写法&lt;/p&gt;
&lt;p&gt;使用ServerName * 会报Invalid ServerName &amp;#8220;*&amp;#8221; use ServerAlias to set multiple server names.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;【安装配置过程1】&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;

[root@xupeng build]cd httpd-2.4.1
[root@xupeng httpd-2.4.1]# ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-speling --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-ssl --with-ssl=/usr/local/openssl/ --enable-rewrite --enable-so
checking for APR... no
configure: error: APR not found.  Please read the documentation.

[root@xupeng httpd-2.4.1]# ./buildconf
WARNING: You are using an outdated version of autoconf.
WARNING: This may lead to less than optimal performance of httpd.
WARNING: You should use autoconf 2.60 or newer.

You don't have a copy of the apr source in srclib/apr.
Please get the source using the following instructions,
or specify the location of the source with
--with-apr=[path to apr] :

   svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr

[root@xupeng httpd-2.4.1]svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr
[root@xupeng httpd-2.4.1]cd srclib/apr
[root@xupeng apr]# ./buildconf
buildconf: checking installation...
buildconf: python version 2.4.3 (ok)
buildconf: autoconf version 2.59 (ok)
buildconf: libtool not found.
           You need libtool version 1.4 or newer installed
           to build APR from SVN.
           (libtool 2.x not supported yet)
[root@xupeng apr]# yum install libtool

[root@xupeng apr]# ./configure --prefix=/usr/local/apr
configure: error: No XML parser found!  Please specify --with-expat or --with-libxml2

[root@xupeng apr]# ./configure --prefix=/usr/local/apr --with-libxml2 &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install

[root@xupeng httpd-2.4.1]# ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-speling --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-ssl --with-ssl=/usr/local/openssl/ --enable-rewrite --enable-so --with-apr=/usr/local/apr
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

[root@xupeng build]wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz

[root@xupeng build]tar zxvf pcre-8.21.tar.gz
[root@xupeng build] cd pcre-8.21
[root@xupeng pcre-8.21]./configure --prefix=/usr/local/pcre &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install

[root@xupeng httpd-2.4.1]./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-speling --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-ssl --with-ssl=/usr/local/openssl/ --enable-rewrite --enable-so --with-apr=/usr/local/apr --with-pcre=/usr/local/pcre &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;如服务器上没有svn环境可参考方法2&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;【安装配置方法2】&lt;/strong&gt;&lt;br /&gt;
如果之前安装过httpd或者yum方式安装了apr apr-util需要卸载&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;yum remove apr apr-util httpd&lt;/pre&gt;
&lt;p&gt;apr,apr-util下载地址&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.6.tar.gz&quot; target=&quot;_blank&quot;&gt;http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.6.tar.gz&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.4.1.tar.gz&quot; target=&quot;_blank&quot;&gt;http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.4.1.tar.gz&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;编译和安装 apr 1.4.6&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
cd apr
./configure --prefix=/usr/local/apr-httpd/ &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install
&lt;/pre&gt;
&lt;p&gt;编译和安装 apr-util 1.4.1&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
cd ../apr-util
./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/ &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install
&lt;/pre&gt;
&lt;p&gt;编译 httpd&lt;/p&gt;
&lt;pre class=&quot;brush: php; title: ; notranslate&quot;&gt;
cd ../httpd-2.4.1
./configure  --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-speling --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-ssl --with-ssl=/usr/local/openssl/ --enable-rewrite --enable-so --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/
make &amp;amp;&amp;amp; make install
&lt;/pre&gt;
&lt;p&gt;其中感谢王碧州同学的帮助，哈哈！&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/623273440/greytaro/feedsky/s.gif?r=http://www.jiunile.com/http2-4-1-%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%bf%87%e7%a8%8b.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/http2-4-1-%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%bf%87%e7%a8%8b.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>http2.4.1 安装配置过程&lt;img src=&quot;http://www1.feedsky.com/t1/623273440/greytaro/feedsky/s.gif?r=http://www.jiunile.com/http2-4-1-%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%bf%87%e7%a8%8b.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>运维|配置词典</category><category>运维|APPServer</category><category>http2.4.1</category><category>运维|学习分享</category><pubDate>Thu, 23 Feb 2012 17:08:14 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/http2-4-1-%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%bf%87%e7%a8%8b.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1318</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/http2-4-1-%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%bf%87%e7%a8%8b.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/623273440/6335187</fs:itemid></item><item><title>Apache HTTP Server 2.4.1正式发布，重大改进版本</title><link>http://www.jiunile.com/apache-http-server-2-4-1%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%ef%bc%8c%e9%87%8d%e5%a4%a7%e6%94%b9%e8%bf%9b%e7%89%88%e6%9c%ac.html</link><content:encoded>&lt;p&gt;Apache软件基金会今天正式发布了Apache HTTP Server（HTTPD）2.4.1，这个版本是新一代的2.4分支的首个正式版本。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.jiunile.com/wp-content/uploads/2012/02/1.gif&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-full wp-image-1316&quot; title=&quot;1&quot; src=&quot;http://www.jiunile.com/wp-content/uploads/2012/02/1.gif&quot; alt=&quot;&quot; width=&quot;560&quot; height=&quot;72&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Apache HTTP Server项目团队称，&lt;strong&gt;这是最新的、也是最好的一个版本，添加了许多新的模块，扩展了现有的功能，增强了灵活性。众多的性能及功能改进，使得该版本更适合日益流行的云环境。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;该版本的主要改进包括：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;改善了服务器性能（减少了资源利用，增强了并发能力）&lt;/li&gt;
&lt;li&gt;支持异步I/O&lt;/li&gt;
&lt;li&gt;动态反向代理配置&lt;/li&gt;
&lt;li&gt;比纯事件驱动的Web服务器的性能更好&lt;/li&gt;
&lt;li&gt;更精准的超时和资源利用限制能力&lt;/li&gt;
&lt;li&gt;增强了微调缓存支持，专为高流量服务器和代理服务器打造&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;另外，该版本还简化了问题分析、提高了配置的灵活性、增强了验证和授权能力、重新检查和修订了文档等，详细信息参阅：&lt;a href=&quot;http://httpd.apache.org/docs/trunk/new_features_2_4.html&quot; target=&quot;_blank&quot;&gt;New Features in httpd 2.4&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Apache HTTP Server自1996年4月诞生以来，已经走过了17个年头，&lt;strong&gt;目前已成为互联网上最流行的Web服务器，有将近4亿网站使用该Web服务器。&lt;/strong&gt;Apache基金会也在2.4分支首发之际，&lt;a href=&quot;http://mail-archives.apache.org/mod_mbox/www-announce/201202.mbox/%3C1329832713.88271.YahooMailNeo@web29702.mail.ird.yahoo.com%3E&quot; target=&quot;_blank&quot;&gt;发公告庆祝了这一记录&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;下载地址：&lt;a href=&quot;http://httpd.apache.org/download.cgi#apache24&quot; target=&quot;_blank&quot;&gt;http://httpd.apache.org/download.cgi#apache24&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: right;&quot;&gt;来自iteye&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/623273441/greytaro/feedsky/s.gif?r=http://www.jiunile.com/apache-http-server-2-4-1%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%ef%bc%8c%e9%87%8d%e5%a4%a7%e6%94%b9%e8%bf%9b%e7%89%88%e6%9c%ac.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.jiunile.com/apache-http-server-2-4-1%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%ef%bc%8c%e9%87%8d%e5%a4%a7%e6%94%b9%e8%bf%9b%e7%89%88%e6%9c%ac.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>Apache HTTP Server 2.4.1正式发布，重大改进版本&lt;img src=&quot;http://www1.feedsky.com/t1/623273441/greytaro/feedsky/s.gif?r=http://www.jiunile.com/apache-http-server-2-4-1%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%ef%bc%8c%e9%87%8d%e5%a4%a7%e6%94%b9%e8%bf%9b%e7%89%88%e6%9c%ac.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>运维|APPServer</category><category>apche</category><category>运维|学习分享</category><pubDate>Wed, 22 Feb 2012 13:41:34 +0800</pubDate><author>xupeng</author><comments>http://www.jiunile.com/apache-http-server-2-4-1%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%ef%bc%8c%e9%87%8d%e5%a4%a7%e6%94%b9%e8%bf%9b%e7%89%88%e6%9c%ac.html#comments</comments><guid isPermaLink="false">http://www.jiunile.com/?p=1315</guid><dc:creator>xupeng</dc:creator><fs:srclink>http://www.jiunile.com/apache-http-server-2-4-1%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%ef%bc%8c%e9%87%8d%e5%a4%a7%e6%94%b9%e8%bf%9b%e7%89%88%e6%9c%ac.html</fs:srclink><fs:srcfeed>http://www.jiunile.com/feed</fs:srcfeed><fs:itemid>feedsky/greytaro/~8610532/623273441/6335187</fs:itemid></item></channel></rss>
