<?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>iCodex&#039;s Blog</title> <atom:link href="http://icodex.org/feed/" rel="self" type="application/rss+xml" /><link>http://icodex.org</link> <description>nothing</description> <lastBuildDate>Tue, 09 Mar 2010 15:54:35 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>春晚植入广告细节曝光</title><link>http://icodex.org/2010/03/%e6%98%a5%e6%99%9a%e6%a4%8d%e5%85%a5%e5%b9%bf%e5%91%8a%e7%bb%86%e8%8a%82%e6%9b%9d%e5%85%89/</link> <comments>http://icodex.org/2010/03/%e6%98%a5%e6%99%9a%e6%a4%8d%e5%85%a5%e5%b9%bf%e5%91%8a%e7%bb%86%e8%8a%82%e6%9b%9d%e5%85%89/#comments</comments> <pubDate>Thu, 04 Mar 2010 04:01:18 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[扯谈]]></category> <category><![CDATA[春晚]]></category><guid
isPermaLink="false">http://icodex.org/?p=179</guid> <description><![CDATA[有点怀念以前的春晚,现在的春晚植入广告太多.太商业了,娱乐了观看春晚的老百姓.
下图为春晚植入广告细节:Related PostsNo Related Post]]></description> <content:encoded><![CDATA[<p>有点怀念以前的春晚,现在的春晚植入广告太多.太商业了,娱乐了观看春晚的老百姓.</p><p>下图为春晚植入广告细节:<span
id="more-179"></span></p><p><a
rel="attachment wp-att-181" href="http://icodex.org/2010/03/%e6%98%a5%e6%99%9a%e6%a4%8d%e5%85%a5%e5%b9%bf%e5%91%8a%e7%bb%86%e8%8a%82%e6%9b%9d%e5%85%89/cctv-chunwan-ad/"><img
class="alignnone size-full wp-image-181" title="CCTV-chunwan-AD" src="http://icodex.org/wp-content/uploads/2010/03/CCTV-chunwan-AD.jpg" alt="" width="535" height="618" /></a></p><h2  class="related_post_title">Related Posts</h2><ul
class="related_post"><li>No Related Post</li></ul>]]></content:encoded> <wfw:commentRss>http://icodex.org/2010/03/%e6%98%a5%e6%99%9a%e6%a4%8d%e5%85%a5%e5%b9%bf%e5%91%8a%e7%bb%86%e8%8a%82%e6%9b%9d%e5%85%89/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>创造力都是憋出来的</title><link>http://icodex.org/2010/03/%e5%88%9b%e9%80%a0%e5%8a%9b%e9%83%bd%e6%98%af%e6%86%8b%e5%87%ba%e6%9d%a5%e7%9a%84/</link> <comments>http://icodex.org/2010/03/%e5%88%9b%e9%80%a0%e5%8a%9b%e9%83%bd%e6%98%af%e6%86%8b%e5%87%ba%e6%9d%a5%e7%9a%84/#comments</comments> <pubDate>Wed, 03 Mar 2010 09:47:20 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[扯谈]]></category> <category><![CDATA[情绪稳定]]></category><guid
isPermaLink="false">http://icodex.org/?p=177</guid> <description><![CDATA[freezeblue 写道 "中国人民正在不断地丰富着英语词汇——Smilence（笑而不语）、Democrazy（民主妄想）、Freedamn（自由）、 Shitizen（P民）、Innernet（内联网）、Yakshit（亚克蜥）、Departyment（有关部门）、Corpspend（捞尸费）、Jokarlist（妓者）、Vegeteal（偷菜）、Sexretary（秘书）、Emotionormal（情绪稳定）……更多由志愿翻译者团队及网友收集、整理的中国特色英文词汇以及他们的内涵和用法请阅读那些有中国特色的自创英文单词。"
Related PostsNo Related Post]]></description> <content:encoded><![CDATA[<p><span
style="color: #0000ff;">freezeblue 写道 "中国人民正在不断地丰富着英语词汇——Smilence（笑而不语）、Democrazy（民主妄想）、Freedamn（自由）、 Shitizen（P民）、Innernet（内联网）、Yakshit（亚克蜥）、Departyment（有关部门）、Corpspend（捞尸费）、Jokarlist（妓者）、Vegeteal（偷菜）、Sexretary（秘书）、Emotionormal（情绪稳定）……更多由志愿翻译者团队及网友收集、整理的中国特色英文词汇以及他们的内涵和用法请阅读那些有中国特色的自创英文单词。"</span></p><h2  class="related_post_title">Related Posts</h2><ul
class="related_post"><li>No Related Post</li></ul>]]></content:encoded> <wfw:commentRss>http://icodex.org/2010/03/%e5%88%9b%e9%80%a0%e5%8a%9b%e9%83%bd%e6%98%af%e6%86%8b%e5%87%ba%e6%9d%a5%e7%9a%84/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>APF:Linux下强大的防火墙组件</title><link>http://icodex.org/2010/03/powerful-firewall-advanced-policy-firewall-apf/</link> <comments>http://icodex.org/2010/03/powerful-firewall-advanced-policy-firewall-apf/#comments</comments> <pubDate>Tue, 02 Mar 2010 05:37:31 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[技术]]></category> <category><![CDATA[APF]]></category> <category><![CDATA[DOS]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[VPS]]></category><guid
isPermaLink="false">http://icodex.org/?p=137</guid> <description><![CDATA[什么是APF？
APF(Advanced Policy Firewall)是 Rf-x Networks 出品的Linux环境下的软件防火墙,被大部分Linux服务器管理员所采用,使用iptables的规则,易于理解及使用.可算是Linux使用较多的防火墙.APF的配置参数众多,有效利用这些配置参数可加强你的服务器安全,APF应该在每一台Linux服务器中得到应用.
安装APF
1.下载最新的安装包并解压缩,APF项目详细信息.
#cd /usr/local/src
#wget http://www.rfxn.com/downloads/apf-current.tar.gz
#tar -zxf apf-current.tar.gz
#cd apf-9.7-1/
2.执行安装
#sh ./install.sh
结束安装好你会得到一些信息:
...
Installation Details:
Install path:         /etc/apf/
Config path:          /etc/apf/conf.apf
Executable path:      /usr/local/sbin/apf
...
3.进行详细配置
#vi /etc/apf/conf.apf
默认的参数适合大多数场合,按照需要进行修改即可
DEVEL_MODE="1" &#62;&#62; DEVEL_MODE="0"
IFACE_IN="eth0"
IFACE_OUT="eth0"
流入端口过滤
# Common ingress (inbound) TCP ports
IG_TCP_CPORTS="20,21,22,25,26,53,80,110,143,443,465,993,995,3306"
# Common ingress (inbound) UDP ports
IG_UDP_CPORTS="21,53,465"
流出端口过滤,虚拟主机推荐开启
# Outbound (egress) filtering
EGF="1"
# Common outbound (egress) TCP ports
EG_TCP_CPORTS="21,22,25,26,37,43,53,80,110,113,443,465,3306"
# Common outbound (egress) UDP ports
EG_UDP_CPORTS="20,21,53,465"
ICMP过滤
# Common ICMP outbound (egress) types
# 'internals/icmp.types' for type definition; <a
href="http://icodex.org/2010/03/powerful-firewall-advanced-policy-firewall-apf/" class="more-link">More &#62;</a>]]></description> <content:encoded><![CDATA[<h2>什么是APF？</h2><p>APF(Advanced Policy Firewall)是 <a
href="http://www.rfxn.com/">Rf-x Networks</a> 出品的Linux环境下的软件防火墙,被大部分Linux服务器管理员所采用,使用iptables的规则,易于理解及使用.可算是Linux使用较多的防火墙.APF的配置参数众多,有效利用这些配置参数可加强你的服务器安全,APF应该在每一台Linux服务器中得到应用.<span
id="more-137"></span></p><h2>安装APF</h2><p>1.下载最新的安装包并解压缩,<a
href="http://www.rfxn.com/projects/advanced-policy-firewall/">APF项目详细信息</a>.</p><blockquote><p><code>#cd /usr/local/src<br
/> #wget <a
href="http://www.rfxn.com/downloads/apf-current.tar.gz">http://www.rfxn.com/downloads/apf-current.tar.gz</a><a
href="http://www.rfxn.com/downloads/apf-current.tar.gz"><strong> </strong></a><br
/> #tar -zxf apf-current.tar.gz<br
/> #cd apf-9.7-1/</code></p></blockquote><p>2.执行安装</p><blockquote><p><code>#sh ./install.sh</code></p></blockquote><p>结束安装好你会得到一些信息:</p><blockquote><p><code>...<br
/> Installation Details:<br
/> Install path:         /etc/apf/<br
/> Config path:          /etc/apf/conf.apf<br
/> Executable path:      /usr/local/sbin/apf<br
/> ...</code></p></blockquote><p>3.进行详细配置</p><blockquote><p><code>#vi /etc/apf/conf.apf</code></p></blockquote><p>默认的参数适合大多数场合,按照需要进行修改即可</p><blockquote><p><code>DEVEL_MODE="1" &gt;&gt; DEVEL_MODE="0"</code></p></blockquote><blockquote><p><code>IFACE_IN="eth0"<br
/> IFACE_OUT="eth0"</code></p></blockquote><p>流入端口过滤</p><blockquote><p><code># Common ingress (inbound) TCP ports<br
/> IG_TCP_CPORTS="20,21,22,25,26,53,80,110,143,443,465,993,995,3306"<br
/> # Common ingress (inbound) UDP ports<br
/> IG_UDP_CPORTS="21,53,465"</code></p></blockquote><p>流出端口过滤,<span
style="color: #ff0000;">虚拟主机推荐开启</span></p><blockquote><p><code># Outbound (egress) filtering<br
/> EGF="1"<br
/> # Common outbound (egress) TCP ports<br
/> EG_TCP_CPORTS="21,22,25,26,37,43,53,80,110,113,443,465,3306"<br
/> # Common outbound (egress) UDP ports<br
/> EG_UDP_CPORTS="20,21,53,465"</code></p></blockquote><p>ICMP过滤</p><blockquote><p><code># Common ICMP outbound (egress) types<br
/> # 'internals/icmp.types' for type definition; 'all' is wildcard for any<br
/> EG_ICMP_TYPES="all"</code></p></blockquote><p>另外还有两个值得注意的设置文件: /etc/apf/allow_hosts.rules 和 /etc/apf/deny_hosts.rules 可设置目标主机的过滤规则.如添加信任主机操作等.</p><p>启动APF</p><blockquote><p><code>#/usr/local/sbin/apf -s</code></p></blockquote><p>重启APF</p><blockquote><p><code>#/usr/local/sbin/apf -r</code></p></blockquote><p>查看运行日志</p><blockquote><p><code>#tail -f /var/log/apf_log</code></p></blockquote><p>添加为系统启动</p><blockquote><p><code>#vi /etc/rc.local</code></p></blockquote><p>在其中添加 "/usr/local/sbin/apf -s" 即可(不含双引号).</p><p>详细参数说明</p><blockquote><pre>usage /usr/local/sbin/apf [OPTION]
-s|--start ......................... load all firewall rules
-r|--restart ....................... stop (flush) &amp; reload firewall rules
-f|--stop........ .................. stop (flush) all firewall rules
-l|--list .......................... list all firewall rules
-t|--status ........................ output firewall status log
-e|--refresh ....................... refresh &amp; resolve dns names in trust rules
-a HOST CMT|--allow HOST COMMENT ... add host (IP/FQDN) to allow_hosts.rules and
 immediately load new rule into firewall
-d HOST CMT|--deny HOST COMMENT .... add host (IP/FQDN) to deny_hosts.rules and
 immediately load new rule into firewall
-u|--remove HOST ................... remove host from [glob]*_hosts.rules
 and immediately remove rule from firewall
-o|--ovars ......................... output all configuration options</pre></blockquote><p>此外,APF自9.6 (rev:2)版本之后增加了RAB模块.该模块取代了旧版本的antidos模块.可有效减轻拒绝服务攻击带来的影响,但需要iptables的内核模块ipt_recent的支持.如下图我在VPS上启动APF后的屏显,提示RAB模块无法启用.内核模块itp_recent没有找到.因此建议在内核支持以及iptables模块支持的情况下使用.</p><p><a
rel="attachment wp-att-145" href="http://icodex.org/2010/03/powerful-firewall-advanced-policy-firewall-apf/apf/"><img
class="alignnone size-medium wp-image-145" title="apf" src="http://icodex.org/wp-content/uploads/2010/03/apf-400x160.jpg" alt="" width="400" height="160" /></a></p><h3>PS:如果您想在VPS等不支持编译内核或内核不支持的机器上加装能有效减轻拒绝服务攻击(DOS)的功能.请<a
href="http://icodex.org/2010/03/help-you-mitigate-dos-atacks-with-dos-deflate/">参考这篇文章</a>.</h3><h2  class="related_post_title">Related Posts</h2><ul
class="related_post"><li><a
href="http://icodex.org/2010/03/help-you-mitigate-dos-atacks-with-dos-deflate/" title="DOS-Deflate:帮助您有效减轻 DOS 攻击伤害">DOS-Deflate:帮助您有效减轻 DOS 攻击伤害</a> (1)</li></ul>]]></content:encoded> <wfw:commentRss>http://icodex.org/2010/03/powerful-firewall-advanced-policy-firewall-apf/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>DOS-Deflate:帮助您有效减轻 DOS 攻击伤害</title><link>http://icodex.org/2010/03/help-you-mitigate-dos-atacks-with-dos-deflate/</link> <comments>http://icodex.org/2010/03/help-you-mitigate-dos-atacks-with-dos-deflate/#comments</comments> <pubDate>Tue, 02 Mar 2010 03:29:26 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[技术]]></category> <category><![CDATA[APF]]></category> <category><![CDATA[DOS]]></category> <category><![CDATA[VPS]]></category><guid
isPermaLink="false">http://icodex.org/?p=132</guid> <description><![CDATA[DOS-Deflate 是由Zaf开发的脚本,最初是在MediaLayer服务器上使用,以协助管理员解决拒绝服务攻击(DOS)问题.如何防范拒绝服务攻击一直是服务器管理员研究的一个课题,尤其是使用VPS(虚拟服务器)的管理员.由于是在虚拟的环境下,既不好要求服务商增加硬件防火墙,又因为本身虚拟的架构导致了一些内核模块(如:connlimit)无法安装.VPS或者服务器要完全防止拒绝服务攻击是不太现实的,依靠某个模块只能减轻攻击产生的影响,并不能真正杜绝攻击.服务器性能及网络频宽决定了防止攻击的实施难易度.
诡谲在这里推荐您使用DOS-Deflate脚本.通过APF添加动态过滤.脚本安装简单,防范攻击的效果也很不错.但是需要注意,安装前需确定Advanced Policy Firewall (APF)已经在你的系统安装并运行良好.否则将不会起到封禁攻击IP的作用.
安装step by step
1.以root用户登录终端.
2.下载安装脚本
#cd /usr/local/src
#wget http://www.inetbase.com/scripts/ddos/install.sh
3.安装防护
#sh ./install.sh
安装完成之后.可以在/usr/local/ddos/路径找到配置文件和sh脚本.配置十分简单,你只需编辑/usr/local/ddos/ddos.conf文件.
参数配置示范:
##### Paths of the script and other files
PROGDIR="/usr/local/ddos"
PROG="/usr/local/ddos/ddos.sh"
IGNORE_IP_LIST="/usr/local/ddos/ignore.ip.list"  # 白名单.如有反向代理,注意添加本机地址和本机外网IP地址,防止提供反向代理的主机被判定为攻击.
CRON="/etc/cron.d/ddos.cron"
APF="/etc/apf/apf"
IPT="/sbin/iptables"
##### frequency in minutes for running the script
##### Caution: Every time this setting is changed, run the script with --cron
##### option so that the new frequency takes effect
FREQ=1
##### How many connections define a bad IP? Indicate that <a
href="http://icodex.org/2010/03/help-you-mitigate-dos-atacks-with-dos-deflate/" class="more-link">More &#62;</a>]]></description> <content:encoded><![CDATA[<p>DOS-Deflate 是由Zaf开发的脚本,最初是在MediaLayer服务器上使用,以协助管理员解决拒绝服务攻击(DOS)问题.如何防范拒绝服务攻击一直是服务器管理员研究的一个课题,尤其是使用VPS(虚拟服务器)的管理员.由于是在虚拟的环境下,既不好要求服务商增加硬件防火墙,又因为本身虚拟的架构导致了一些内核模块(如:connlimit)无法安装.VPS或者服务器要完全防止拒绝服务攻击是不太现实的,依靠某个模块只能减轻攻击产生的影响,并不能真正杜绝攻击.服务器性能及网络频宽决定了防止攻击的实施难易度.<span
id="more-132"></span></p><p>诡谲在这里推荐您使用DOS-Deflate脚本.通过APF添加动态过滤.脚本安装简单,防范攻击的效果也很不错.但是需要注意,安装前需确定<a
href="http://icodex.org/2010/03/powerful-firewall-advanced-policy-firewall-apf/">Advanced Policy Firewall (APF)</a>已经在你的系统安装并运行良好.否则将不会起到封禁攻击IP的作用.</p><h2>安装step by step</h2><p>1.以root用户登录终端.</p><p>2.下载安装脚本</p><blockquote><p>#cd /usr/local/src<br
/> #wget http://www.inetbase.com/scripts/ddos/install.sh</p></blockquote><p>3.安装防护</p><blockquote><p>#sh ./install.sh</p></blockquote><p>安装完成之后.可以在/usr/local/ddos/路径找到配置文件和sh脚本.配置十分简单,你只需编辑/usr/local/ddos/ddos.conf文件.</p><p>参数配置示范:</p><blockquote><p><code>##### Paths of the script and other files<br
/> PROGDIR="/usr/local/ddos"<br
/> PROG="/usr/local/ddos/ddos.sh"<br
/> IGNORE_IP_LIST="/usr/local/ddos/ignore.ip.list"  # <span
style="color: #ff0000;">白名单.如有反向代理,注意添加本机地址和本机外网IP地址,防止提供反向代理的主机被判定为攻击.</span><br
/> CRON="/etc/cron.d/ddos.cron"<br
/> APF="/etc/apf/apf"<br
/> IPT="/sbin/iptables"</code></p><p><code>##### frequency in minutes for running the script<br
/> ##### Caution: Every time this setting is changed, run the script with --cron<br
/> ##### option so that the new frequency takes effect<br
/> FREQ=1</code></p><p><code>##### How many connections define a bad IP? Indicate that below.  # <span
style="color: #ff0000;">单IP发起连接数阀值,不建议设置太低.</span><br
/> NO_OF_CONNECTIONS=150</code></p><p><code>##### APF_BAN=1 (Make sure your APF version is atleast 0.96)<br
/> ##### APF_BAN=0 (Uses iptables for banning ips instead of APF)<br
/> APF_BAN=1</code></p><p><code>##### KILL=0 (Bad IPs are'nt banned, good for interactive execution of script)<br
/> ##### KILL=1 (Recommended setting)<br
/> KILL=1</code></p><p><code>##### An email is sent to the following address when an IP is banned.   # <span
style="color: #ff0000;">当单IP发起的连接数超过阀值后,将发邮件给指定的收件人.</span><br
/> ##### Blank would suppress sending of mails<br
/> EMAIL_TO="root"</code></p><p><code>##### Number of seconds the banned ip should remain in blacklist.   # <span
style="color: #ff0000;">设置被挡IP多少秒后移出黑名单.</span><br
/> BAN_PERIOD=600<br
/> </code></p></blockquote><p>模拟发起dos攻击后,系统管理员将收到邮件,告知过去1分钟禁止了哪些IP和其发起的连接数.</p><p><a
rel="attachment wp-att-164" href="http://icodex.org/2010/03/help-you-mitigate-dos-atacks-with-dos-deflate/banned-ips/"><img
class="alignnone size-medium wp-image-164" title="Banned IPs" src="http://icodex.org/wp-content/uploads/2010/03/Banned-IPs-400x134.jpg" alt="Banned IPs" width="400" height="134" /></a></p><h2>卸载</h2><p>以root用户登录终端,下载反安装脚本</p><blockquote><p><code>#wget http://www.inetbase.com/scripts/ddos/uninstall.ddos<br
/> #sh ./uninstall.ddos<br
/> </code></p></blockquote><h2  class="related_post_title">Related Posts</h2><ul
class="related_post"><li><a
href="http://icodex.org/2010/03/powerful-firewall-advanced-policy-firewall-apf/" title="APF:Linux下强大的防火墙组件">APF:Linux下强大的防火墙组件</a> (1)</li></ul>]]></content:encoded> <wfw:commentRss>http://icodex.org/2010/03/help-you-mitigate-dos-atacks-with-dos-deflate/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>nginx 自动安装脚本 For cPanel</title><link>http://icodex.org/2010/02/nginx%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac-for-cpanel/</link> <comments>http://icodex.org/2010/02/nginx%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac-for-cpanel/#comments</comments> <pubDate>Mon, 22 Feb 2010 19:54:26 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[技术]]></category> <category><![CDATA[cPanel]]></category> <category><![CDATA[Hack]]></category> <category><![CDATA[nginx]]></category><guid
isPermaLink="false">http://icodex.org/?p=76</guid> <description><![CDATA[为cPanel主机添加nginx服务器软件,让nginx跑前端处理静态文件,两者相比较来说,加装nginx后的资源消耗比单纯跑apache少很多.最近对nginx自动安装脚本进行很多修改,我仔细的测试了几次.觉得可以应用于生产环境,就在自己的机器上安装了.所以这篇就详细为大家说明是怎样做到的.
这里引用cPanel Forums上的帖子.作者blargman写了一个专门为cPanel打造的nginx自动安装脚本.
Evidently I don't know hot to post in the right forum.
This is an automated nginx installer for cpanel. Integrates so that  domain adding/removal is all done automatically.
Some people had asked for cpanel support. In lieu of that, this does  pretty much everything I can think of that they would do. It creates <a
href="http://icodex.org/2010/02/nginx%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac-for-cpanel/" class="more-link">More &#62;</a>]]></description> <content:encoded><![CDATA[<p>为cPanel主机添加nginx服务器软件,让nginx跑前端处理静态文件,两者相比较来说,加装nginx后的资源消耗比单纯跑apache少很多.最近对nginx自动安装脚本进行很多修改,我仔细的测试了几次.觉得可以应用于生产环境,就在自己的机器上安装了.所以这篇就详细为大家说明是怎样做到的.</p><p>这里引用cPanel Forums上的帖子.作者<a
rel="nofollow" href="http://forums.cpanel.net/members/blargman/">blargman</a>写了一个专门为cPanel打造的nginx自动安装脚本.<span
id="more-76"></span></p><blockquote><p>Evidently I don't know hot to post in the right forum.</p><p>This is an automated nginx installer for cpanel. Integrates so that  domain adding/removal is all done automatically.<br
/> Some people had asked for cpanel support. In lieu of that, this does  pretty much everything I can think of that they would do. It creates a  vhost for each domain/addon/subdomain and serves up static content.</p><p>Let me know if you have any thoughts/questions or better yet  suggestions.<br
/> <a
onclick="pageTracker._trackPageview  ('/out/http_blargman_com_public_tar');" rel="nofollow" href="http://blargman.com/public.tar" target="_blank">http://blargman.com/public.tar</a></p></blockquote><p>以上是作者原文,原文地址:<a
href="http://forums.cpanel.net/f5/nginx-automated-installer-148109.html">点击这里</a>.安装方法很简单(建议做好备份),如下:</p><blockquote><p><code>cd /usr/local/src<br
/> wget http://blargman.com/public.tar<br
/> tar xf public.tar<br
/> cd publicnginx<br
/> ./nginxinstaller install</code></p></blockquote><p>安装好之后,重启nginx,执行命令:<strong>/etc/init.d/nginx restart</strong>.Nginx的配置文件均在<strong>/etc/nginx</strong>当中,各用户绑定的域名(附加域,子域等)均在<strong>/etc/nginx/vhosts</strong></p><p>卸载:</p><p>以上下载步骤不变.将最后一步<code>./nginxinstaller install改为</code><code>./nginxinstaller uninstall执行即可.</code></p><p>--------------------------------------------------------------------------------------------------</p><p><span
style="color: #ff0000;"><strong>请注意,如果你已经安装作者发布的版本请将作者原版本卸载后再进行操作(</strong></span><code>./nginxinstaller uninstall</code><span
style="color: #ff0000;"><strong>).这里主要针对几个问题逐一进行修正.你也可以直接下载我修正后的版本</strong></span></p><p><strong>访问日志记录重复</strong></p><p>因为作者将access_log放在location /外面,导致访客访问动态页面的时候.nginx的日志与apache的日志重复记录.正确的做法是nginx作为前端,只记录静态文件响应日志记录就可以了.因此我们做成修正.</p><blockquote><p><code>cd /usr/local/src<br
/> wget http://blargman.com/public.tar<br
/> tar xf public.tar<br
/> cd publicnginx<br
/> vi createvhosts.py</code></p></blockquote><p>具体改动我用颜色与删除线标识,注意,有两处需要修改,一处为共享IP的设置,另外还有一处独立IP的.方法一致:</p><blockquote><p><code>...<br
/> dedipvhost = """server {<br
/> error_log /var/log/nginx/vhost-error_log warn;<br
/> listen 80;<br
/> server_name %s %s %s;<br
/> <span
style="color: #ff0000;">access_log off;</span><br
/> <span
style="text-decoration: line-through;">access_log /usr/local/apache/domlogs/%s bytes_log;</span><br
/> <span
style="text-decoration: line-through;">access_log /usr/local/apache/domlogs/%s combined;</span><br
/> location ~* \.(gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|htm|html|txt|js|css|exe|zip|rar|gz|tgz|uha|7z|doc|docx|xls|xlsx|pdf)$ {<br
/> <span
style="color: #ff0000;">access_log /usr/local/apache/domlogs/%s bytes_log;<br
/> access_log /usr/local/apache/domlogs/%s combined;</span><br
/> root %s;<br
/> }<br
/> ...</code></p></blockquote><p>之后执行<code>./nginxinstaller install</code>完成安装.</p><p>--------------------------------------------------------------------------------------------------</p><p><strong>后端apache取回客户端访问的真实IP.</strong></p><p>后端apache要取回客户端访问的真实IP,我们知道是要用apache的第三方模块:mod_rpaf.</p><blockquote><p>说明：<a
href="http://stderr.net/apache/rpaf/" target="_blank">http://stderr.net/apache/rpaf/</a><br
/> 下载：<a
href="http://stderr.net/apache/rpaf/download/" target="_blank">http://stderr.net/apache/rpaf/download/</a></p></blockquote><p>这个nginx自动安装脚本也为apache增加了这个模块,并自动添加到httpd.conf配置参数中,但当我打开模块配置文件(/usr/local/apache/conf/includes/rpaf.conf),发现了问题.这一配置无法获取客户端的真实IP.因为缺少参数.解决如下:</p><blockquote><p><code>cd /usr/local/src<br
/> wget http://blargman.com/public.tar<br
/> tar xf public.tar<br
/> cd publicnginx<br
/> vi nginxinstaller2</code></p></blockquote><p>找到"RPAFsethostname On",在换行出添加"RPAFheader X-Forwarded-For",按Esc键后:wq保存退出.</p><p><img
class="alignnone size-full wp-image-189" title="addon-rpaf" src="http://icodex.org/wp-content/uploads/2010/02/addon-rpaf.jpg" alt="" width="269" height="131" /></p><p>之后执行<code>./nginxinstaller install</code>完成安装.</p><p>--------------------------------------------------------------------------------------------------</p><p><strong>伪静态的实现</strong></p><p>实现伪静态,依然可以使用.htaccess完成,nginx放在前端不会影响到apache伪静态.但是需要进行修改.</p><p><strong>为以后建立的域名修改配置:</strong></p><blockquote><p><code>cd /usr/local/src<br
/> wget http://blargman.com/public.tar<br
/> tar xf  public.tar<br
/> cd publicnginx<br
/> vi createvhosts.py</code></p></blockquote><p>找到(一共有两处,一个是共享IP的配置,一个是独立IP的配置,在同一个文件当中):</p><blockquote><p><code>location ~* \.(gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3\<br
/> |mid|wav|swf|flv|<span
style="color: #ff0000;">htm|html</span>|txt|js|css|exe|zip|rar|gz|tgz\<br
/> |uha|7z|doc|docx|xls|xlsx|pdf)$ {</code></p></blockquote><p>将红色的"htm|html"删除即可.这样新建立的域名都可以使用.htaccess伪静态规则了.不受前端nginx的影响.之后执行<code>./nginxinstaller install</code>完成安装.<br
/> --------------------------------------------------------------------------------------------------</p><p><strong>自定义错误页面</strong></p><p>这里必须进行修改,否则当页面出现问题的时候将直接返回nginx的错误页面.我们需要把错误页面转发给后端的apache.这样自定义错误页面才可以正常运作.</p><blockquote><p><code>cd /usr/local/src<br
/> wget http://blargman.com/public.tar<br
/> tar xf public.tar<br
/> cd publicnginx<br
/> vi error_pages.conf</code></p></blockquote><p>输入以下:</p><blockquote><p><code>error_page 400 /400.shtml;<br
/> error_page 401 /401.shtml;<br
/> error_page 402 /402.shtml;<br
/> error_page 403 /403.shtml;<br
/> error_page 404 /404.shtml;<br
/> error_page 405 /405.shtml;<br
/> error_page 406 /406.shtml;<br
/> error_page 407 /407.shtml;<br
/> error_page 408 /408.shtml;<br
/> error_page 500 /500.shtml;<br
/> error_page 501 /501.shtml;<br
/> error_page 502 /502.shtml;<br
/> error_page 503 /503.shtml;<br
/> error_page 504 /504.shtml;</code></p></blockquote><p>按Esc键后:wq保存退出.接着修改createvhosts.py文件.里面有两处(一个为共享IP,另外一个为独立IP)</p><blockquote><p><code>vi createvhosts.py</code></p></blockquote><p>找到server_name这行,在下面添加:</p><blockquote><p><code>include error_pages.conf;</code></p></blockquote><p>如下图:</p><p><img
class="alignnone size-full wp-image-185" title="createvhosts" src="http://icodex.org/wp-content/uploads/2010/02/createvhosts.jpg" alt="" width="426" height="118" /></p><p>保存之后再修改nginxinstaller脚本.</p><blockquote><p><code>vi nginxinstaller</code></p></blockquote><p>找到:</p><blockquote><p><code>proc = subprocess.Popen("rm -f /etc/nginx/nginx.conf &gt; /dev/null 2&gt;&amp;1", shell=True)<br
/> output = proc.communicate()</code></p><p><code>proc = subprocess.Popen("cp /" + currentdir + "/nginx.conf /etc/nginx/nginx.conf", shell=True)<br
/> output = proc.communicate()</code></p></blockquote><p>在下面增加:</p><blockquote><p><code>proc = subprocess.Popen("rm -f /etc/nginx/error_pages.conf &gt; /dev/null 2&gt;&amp;1", shell=True)<br
/> output = proc.communicate()</code></p><p><code>proc = subprocess.Popen("cp /" + currentdir + "/error_pages.conf /etc/nginx/error_pages.conf", shell=True)<br
/> output = proc.communicate()</code></p></blockquote><p>之后执行<code>./nginxinstaller install完成安装.以后</code>绑定的域名就都有设置自定义错误页面的功能了,假如cPanel用户没有自定义错误页面,比如404页面.apache将直接返回apache默认的错误页面.</p><p>完成以上步骤之后执行<code>./nginxinstaller install</code>完成安装.</p><p>--------------------------------------------------------------------------------------------------------------------------</p><p><strong>网址中带有参数转发到后端</strong></p><p>例如有些程序的链接是/news.php/news.jpg?ID=123这样子的,nginx并不支持path_info,它认为这是静态文件地址,从而以静态文件直接解析,但这是错误的,因此需要设定类型,当网址中带有参数时,转发到后端.操作如下:</p><blockquote><p><code>cd /usr/local/src<br
/> wget http://blargman.com/public.tar<br
/> tar xf public.tar<br
/> cd publicnginx<br
/> vi createvhosts.py</code></p></blockquote><p>具体改动我用红颜色标识添注,注意,有两处需要修改,一处为独立IP的设置,另外还有一处共享IP的:</p><blockquote><p><code>...<br
/> dedipvhost = """server {<br
/> error_log /var/log/nginx/vhost-error_log warn;<br
/> listen 80;<br
/> server_name %s %s %s;<br
/> access_log /usr/local/apache/domlogs/%s bytes_log;<br
/> access_log /usr/local/apache/domlogs/%s combined;<br
/> location ~*  \.(gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|htm|html|txt|js|css|exe|zip|rar|gz|tgz|uha|7z|doc|docx|xls|xlsx|pdf)$  {<br
/> root %s;<br
/> <span
style="color: #ff0000;">try_files $uri @backend;</span><br
/> }<br
/> <span
style="color: #ff0000;">location @backend {<br
/> internal;<br
/> proxy_redirect http://%s:8081 http://%s;<br
/> %s<br
/> proxy_redirect http://%s:8081 http://%s;<br
/> proxy_pass http://%s:8081;<br
/> proxy_set_header   Host   $host;<br
/> proxy_set_header   X-Real-IP  $remote_addr;<br
/> proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;</span><br
/> }<br
/> ...<br
/> """ % (domain, alias, passedip, domain + "-bytes_log", domain, docroot, <span
style="color: #ff0000;">domain, domain, aliasstring, passedip, passedip, passedip,</span> domain, domain, aliasstring, passedip, passedip, passedip)<br
/> ...</code></p></blockquote><p>--------------------------------------------------------------------------------------------------------------------------</p><blockquote><p><code>...<br
/> sharedipvhost = """server {<br
/> error_log /var/log/nginx/vhost-error_log warn;<br
/> listen 80;<br
/> server_name %s %s;<br
/> access_log /usr/local/apache/domlogs/%s bytes_log;<br
/> access_log /usr/local/apache/domlogs/%s combined;<br
/> location ~*  \.(gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|htm|html|txt|js|css|exe|zip|rar|gz|tgz|uha|7z|doc|docx|xls|xlsx|pdf)$  {<br
/> root %s;<br
/> <span
style="color: #ff0000;">try_files $uri @backend;</span><br
/> }<br
/> <span
style="color: #ff0000;">location @backend {<br
/> internal;<br
/> proxy_redirect http://%s:8081 http://%s;<br
/> %s<br
/> proxy_pass http://%s:8081;<br
/> proxy_set_header   Host   $host;<br
/> proxy_set_header   X-Real-IP  $remote_addr;<br
/> proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;</span><br
/> }<br
/> ...<br
/> """ % (domain, alias, domain + "-bytes_log", domain, docroot, <span
style="color: #ff0000;">domain, domain, aliasstring, passedip, </span>domain, domain, aliasstring, passedip)<br
/> ...</code></p></blockquote><p>全部保存后执行<code>./nginxinstaller install</code>完成安装.</p><p>为方便大家使用.以上修改我已经打包成修改版的安装包.安装方法与作者原版一样.请<span
style="color: #0000ff;"><a
href="http://icodex.org/public.tar">点击这里下载</a></span>!</p><p><code>cd /usr/local/src<br
/> wget </code>http://icodex.org/public.tar<br
/> <code> tar xf public.tar<br
/> cd publicnginx<br
/> ./nginxinstaller install</code></p><p>Via:<a
href="http://icodex.org/2010/02/nginx%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac-for-cpanel/">iCodex</a></p><h2  class="related_post_title">Related Posts</h2><ul
class="related_post"><li><a
href="http://icodex.org/2010/02/vps%e5%90%88%e7%a7%9f%e5%8f%ac%e9%9b%86%e7%94%a8%e5%ae%b6/" title="VPS合租召集用家(已结束)">VPS合租召集用家(已结束)</a> (2)</li><li><a
href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/" title="为nginx虚拟主机配置startssl免费https证书">为nginx虚拟主机配置startssl免费https证书</a> (0)</li></ul>]]></content:encoded> <wfw:commentRss>http://icodex.org/2010/02/nginx%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac-for-cpanel/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>VPS合租召集用家(已结束)</title><link>http://icodex.org/2010/02/vps%e5%90%88%e7%a7%9f%e5%8f%ac%e9%9b%86%e7%94%a8%e5%ae%b6/</link> <comments>http://icodex.org/2010/02/vps%e5%90%88%e7%a7%9f%e5%8f%ac%e9%9b%86%e7%94%a8%e5%ae%b6/#comments</comments> <pubDate>Sat, 20 Feb 2010 06:47:51 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[VPS]]></category> <category><![CDATA[cPanel]]></category> <category><![CDATA[VPS合租]]></category><guid
isPermaLink="false">http://icodex.org/?p=34</guid> <description><![CDATA[我是诡谲(QQ:448033662).喜欢WordPress,喜欢鼓捣Linux服务器相关的一些东西.经常玩各类的VPS.直接说正题.这次召集VPS合租用家,是没有打算赚钱的.具体价格我会在后面跟大家说明.那么不打算赚钱,合租的目的是什么呢?就是为了减轻我个人的经济负担.同时能为有需要的朋友提供一个稳定快速的主机.
VPS是Knownhost的第三个方案(VS3)加256M内存和cPanel面板,Knownhost提供Fully Managed,也就是购买了面板就可以得到技术支持.虽然提供的技术支持范围不是很广.但总比没有的好吧.Knownhost在WHT的口碑一直不错,与MT(MediaTemple)属于同个档次.都是属于Virtuozzo架构(以下简称vz).当然我不是纯粹追求口碑,虽然口碑效应在我小小内心占据比较高的权重,但是购买Knownhost考虑比较多的是性能和易用度上.本人玩过比较多的VPS.总结的经验是:vz优于Xen(Xen虽然更接近真实环境,但是单位CPU的价格高.普遍看到的是开放单核心或者双核心.价格与共享物理服务器核心的vz虚拟环境或openvz虚拟环境的VPS持平,在价格大致相同的情况下.选择多核心的VPS可以带来更高的负载能力.).购买cPanel面板也是大家很熟悉的.各大主机商都有提供这套面板.十分容易使用.
介绍此次合租的一些情况,首先是VPS的参数信息,以及提供的合租计划方案等,最后是一些硬性限制等信息.请仔细查阅.
VPS参数:套餐:VS3
数据中心:California (Los Angeles)
虚拟架构:Virtuozzo
操作系统:Linux CentOS 5.4
控制面板:cPanel 11.25.0
硬盘容量:40GB
每月流量:1000GB
内存:1GB (768MB+256MB)
CPU:共享
IP:2枚
月付价格:$56.25 (VS3+cPanel/WHM+256MB RAM)合租计划:
合租定位为博客合租.允许搭建论坛.但需要按照论坛性质("被你妹按","娱乐"类,被"娱乐"类)等特殊情况酌情购买独立IP(85元/年).
VPS共分20份.每份的年付价格为110元整,独立IP费用为85元/年,可购买多份.每份配置如下:磁盘容量:500MB
月流量:30GB
绑定域名:5个
子域名:10个
FTP帐号:5个
MYSQL:5个
E-Mail帐号:5个
控制面板:cPanel服务器环境:Linux(CentOS 5.4) + Nginx + Apache + .htaccess + Php5 + MySQL5 + Perl/CGI + Gzip/Deflate + PDO mySQL + phpMyAdmin + AWStats
特别说明:支持.htaccess伪静态.
其他说明:不允许放置违反美国法律的内容(包括但不限于版权内容等).
不允许成人内容/政治相关/暴力内容等.
不建议运行在线代理程序(如要运行,请购买独立IP,并配合管理员做好优化.)
不允许发布介绍VPN及翻墙技术等GFW敏感话题("国庆"要配合.咱爱国.当然如果你有独立IP的话,可当作没看到这条).
论坛,SNS,在线交友等类型的网站,请购买独立IP.
纯SEO网站,垃圾网站不允许建立.
如有其它要求,在不影响其他用户和不造成系统安全的前提下,可以添加.
独立IP最多只需要2个工作日即可分配给您.万一(我说万一).因自身原因导致独立IP被封,其费用不予退回.
无利润.请勿砍价.成本都摆在那了.是吧.
保留因占用资源过多而退钱赶人的权利,当然我会提供我收集的证据.
最后,别跟我耍流氓,这点对做人来说很重要.测试IP:207.7.92.56
部分合租用户网站:
http://icodex.org
http://www.mallwp.com (独立IP)
http://www.hiyouli.com
http://aiyi.org.cn
现在付款,立即开通,联系方式如下:
QQ(隐身):448033662
E-Mail:admin@evlit.com
已结束Related Postsnginx 自动安装脚本 For cPanel (8)]]></description> <content:encoded><![CDATA[<p>我是诡谲(QQ:448033662).喜欢WordPress,喜欢鼓捣Linux服务器相关的一些东西.经常玩各类的VPS.直接说正题.这次召集VPS合租用家,是没有打算赚钱的.具体价格我会在后面跟大家说明.那么不打算赚钱,合租的目的是什么呢?就是为了减轻我个人的经济负担.同时能为有需要的朋友提供一个稳定快速的主机.<span
id="more-34"></span></p><p>VPS是<a
href="http://knownhost.com/">Knownhost</a>的第三个方案(VS3)加256M内存和cPanel面板,Knownhost提供Fully Managed,也就是购买了面板就可以得到技术支持.虽然提供的技术支持范围不是很广.但总比没有的好吧.<a
href="http://knownhost.com/">Knownhost</a>在WHT的口碑一直不错,与MT(<a
href="http://mediatemple.net/">MediaTemple</a>)属于同个档次.都是属于Virtuozzo架构(以下简称vz).当然我不是纯粹追求口碑,虽然口碑效应在我小小内心占据比较高的权重,但是购买Knownhost考虑比较多的是性能和易用度上.本人玩过比较多的VPS.总结的经验是:<span
style="color: #ff0000;">vz优于Xen</span>(<em>Xen虽然更接近真实环境,但是单位CPU的价格高.普遍看到的是开放单核心或者双核心.价格与共享物理服务器核心的vz虚拟环境或openvz虚拟环境的VPS持平,在价格大致相同的情况下.选择多核心的VPS可以带来更高的负载能力.</em>).购买cPanel面板也是大家很熟悉的.各大主机商都有提供这套面板.十分容易使用.</p><p>介绍此次合租的一些情况,首先是VPS的参数信息,以及提供的合租计划方案等,最后是一些硬性限制等信息.请仔细查阅.</p><p><strong>VPS参数</strong>:</p><ul><li>套餐:VS3</li><li>数据中心:California (Los Angeles)</li><li>虚拟架构:Virtuozzo</li><li>操作系统:Linux CentOS 5.4</li><li>控制面板:cPanel 11.25.0</li><li>硬盘容量:40GB</li><li>每月流量:1000GB</li><li>内存:1GB (768MB+<span
style="color: #ff0000;">256MB</span>)</li><li>CPU:共享</li><li>IP:2枚</li><li>月付价格:$56.25 (VS3+cPanel/WHM+256MB RAM)</li></ul><p><strong>合租计划</strong>:</p><p>合租定位为博客合租.允许搭建论坛.但需要按照论坛性质("被你妹按","娱乐"类,被"娱乐"类)等特殊情况<span
style="color: #ff0000;">酌情</span>购买独立IP(85元/年).</p><p>VPS共分20份.每份的<strong>年付价格为110元整</strong>,独立IP费用为85元/年,可购买多份.每份配置如下:</p><ul><li>磁盘容量:500MB</li><li>月流量:30GB</li><li>绑定域名:5个</li><li>子域名:10个</li><li>FTP帐号:5个</li><li>MYSQL:5个</li><li>E-Mail帐号:5个</li><li>控制面板:cPanel</li></ul><p>服务器环境:Linux(CentOS 5.4) + Nginx + Apache + .htaccess + Php5 + MySQL5 + Perl/CGI + Gzip/Deflate + PDO mySQL + phpMyAdmin + AWStats<br
/> <strong>特别说明</strong>:支持.htaccess伪静态.</p><p><strong>其他说明</strong>:</p><ul><li><span
style="color: #ff0000;">不允许</span>放置违反美国法律的内容(<span
style="color: #ff0000;">包括但不限于版权内容等</span>).</li><li><span
style="color: #ff0000;">不允许</span><span
style="color: #0000ff;">成人内容/政治相关/暴力内容</span>等.</li><li><span
style="color: #ff0000;">不建议</span>运行在线代理程序(如要运行,请购买独立IP,并配合管理员做好优化.)</li><li><span
style="color: #ff0000;">不允许</span>发布介绍VPN及翻墙技术等GFW敏感话题("国庆"要配合.咱爱国.<span
style="color: #ff0000;">当然如果你有独立IP的话,可当作没看到这条</span>).</li><li>论坛,SNS,在线交友等类型的网站,请购买独立IP.</li><li>纯SEO网站,垃圾网站不允许建立.</li><li>如有其它要求,在不影响其他用户和不造成系统安全的前提下,可以添加.</li><li>独立IP最多只需要2个工作日即可分配给您.万一(我说万一).因自身原因导致独立IP被封,其费用不予退回.</li><li>无利润.请勿砍价.成本都摆在那了.是吧.</li><li>保留因占用资源过多而退钱赶人的权利,当然我会提供我收集的证据.</li><li>最后,别跟我耍流氓,这点对做人来说很重要.</li></ul><p><strong>测试IP</strong>:207.7.92.56</p><p><strong>部分合租用户网站</strong>:<br
/> <a
href="http://icodex.org/">http://icodex.org</a><br
/> <a
href="http://www.mallwp.com/">http://www.mallwp.com</a> (独立IP)<br
/> <a
href="http://www.hiyouli.com">http://www.hiyouli.com</a><br
/> <a
href="http://aiyi.org.cn">http://aiyi.org.cn</a></p><p><span
style="text-decoration: line-through;">现在付款,立即开通,联系方式如下:</span></p><p><span
style="text-decoration: line-through;">QQ(隐身):448033662<br
/> E-Mail:admin@evlit.com</span></p><p>已结束<span
style="text-decoration: line-through;"><br
/> </span></p><h2  class="related_post_title">Related Posts</h2><ul
class="related_post"><li><a
href="http://icodex.org/2010/02/nginx%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac-for-cpanel/" title="nginx 自动安装脚本 For cPanel">nginx 自动安装脚本 For cPanel</a> (8)</li></ul>]]></content:encoded> <wfw:commentRss>http://icodex.org/2010/02/vps%e5%90%88%e7%a7%9f%e5%8f%ac%e9%9b%86%e7%94%a8%e5%ae%b6/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>为nginx虚拟主机配置startssl免费https证书</title><link>http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/</link> <comments>http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/#comments</comments> <pubDate>Mon, 08 Feb 2010 05:12:27 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[技术]]></category> <category><![CDATA[https]]></category> <category><![CDATA[nginx]]></category> <category><![CDATA[ssl]]></category><guid
isPermaLink="false">http://icodex.org/?p=14</guid> <description><![CDATA[StartSSL是一个免费颁发SSL证书的机构,被多数有 Linux 背景的软件支持(以Mozilla的Firefox和Thunderbird为首).以前IE是没有StartSSL的根证书的,以至于一段时间IE都会将使用StartSSL证书的网站列为不受信任的网站.
但是现在情况有所改观了,今年9月份,StartCom公司出现在Windows根证书认证程序厂商更新当中,因此StartSSL证书在IE平台上已经可以正常使用的.另外Chrome,苹果Safari浏览器都可以正常识别StartSSL颁发的证书.但是Opera浏览器仍然不能支持.
为 nginx虚拟主机配置startssl证书
前提条件:独立IP.一台Linux机器.Startssl账户申请这里就不说明了.申请很简单,验证域名所有权也很简单.这里就做证书的配置.
我们先为域名生成证书请求文件和密钥.需要生成2048位加密的证书请求.以icodex.org为例,执行命令:
openssl req -new -newkey rsa:2048 -nodes -out icodex.csr -keyout  icodex.key执行之后在/etc/nginx/certs目录中就有icodex.csr. 执行cat icodex.csr查看里面的内容并复制:然后将复制的粘贴到startssl后 台,这里每一步都进行截图:
第一步:第二步:第三步:第四步:第五步:第六步:第七步:第八步:最后一步注意要先将这段代码保存为icodex.crt 放在与icodex.csr icodex.key同个目录.
然后配置nginx,直接丢配置上来.
server {
listen       443;
listen       80;
server_name  os.icodex.org;
root   /home/icodex/os/public_html;
index index.html index.htm index.php;
access_log  /var/log/nginx/os.icodex.org-access.log   access;
ssl    on;
ssl_certificate    /etc/nginx/certs/icodex.crt;
ssl_certificate_key     /etc/nginx/certs/icodex.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers   on;
location ~* ^.+\.(js&#124;css&#124;jpg&#124;jpeg&#124;gif&#124;png&#124;ico&#124;bmp&#124;swf)$ {
expires      7d;
}
# pass the PHP scripts to FastCGI server
#
location ~ .*\.php$ {
fastcgi_index  index.php;
fastcgi_pass    127.0.0.1:9000;
include        <a
href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/" class="more-link">More &#62;</a>]]></description> <content:encoded><![CDATA[<p><a
href="http://www.startssl.com/">StartSSL</a>是一个免费颁发SSL证书的机构,被多数有 Linux 背景的软件支持(以Mozilla的Firefox和Thunderbird为首).以前IE是没有StartSSL的根证书的,以至于一段时间IE都会将使用StartSSL证书的网站列为不受信任的网站.</p><p>但是现在情况有所改观了,今年9月份,StartCom公司出现在Windows根证书认证程序厂商更新当中,因此StartSSL证书在IE平台上已经可以正常使用的.另外Chrome,苹果Safari浏览器都可以正常识别StartSSL颁发的证书.但是Opera浏览器仍然不能支持.<span
id="more-14"></span></p><h2>为 nginx虚拟主机配置startssl证书</h2><p>前提条件:独立IP.一台Linux机器.Startssl账户申请这里就不说明了.申请很简单,验证域名所有权也很简单.这里就做证书的配置.</p><p>我们先为域名生成证书请求文件和密钥.需要生成2048位加密的证书请求.以icodex.org为例,执行命令:</p><blockquote><p>openssl req -new -newkey rsa:2048 -nodes -out icodex.csr -keyout  icodex.key</p></blockquote><p><a
rel="attachment wp-att-15" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/1/"><img
class="alignnone size-medium wp-image-15" title="1" src="http://icodex.org/wp-content/uploads/2010/02/1-400x283.jpg" alt="" width="400" height="283" /></a></p><p>执行之后在/etc/nginx/certs目录中就有icodex.csr. 执行cat icodex.csr查看里面的内容并复制:</p><p><a
rel="attachment wp-att-16" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/2/"><img
class="alignnone size-medium wp-image-16" title="2" src="http://icodex.org/wp-content/uploads/2010/02/2-400x245.jpg" alt="" width="400" height="245" /></a></p><p>然后将复制的粘贴到startssl后 台,这里每一步都进行截图:</p><p>第一步:<br
/> <a
rel="attachment wp-att-17" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/3/"><img
class="alignnone size-medium wp-image-17" title="3" src="http://icodex.org/wp-content/uploads/2010/02/3-400x172.jpg" alt="" width="400" height="172" /></a></p><p>第二步:<br
/> <a
rel="attachment wp-att-18" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/4/"><img
class="alignnone size-medium wp-image-18" title="4" src="http://icodex.org/wp-content/uploads/2010/02/4-400x195.jpg" alt="" width="400" height="195" /></a></p><p>第三步:<br
/> <a
rel="attachment wp-att-19" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/5/"><img
class="alignnone size-medium wp-image-19" title="5" src="http://icodex.org/wp-content/uploads/2010/02/5-400x240.jpg" alt="" width="400" height="240" /></a></p><p>第四步:<br
/> <a
rel="attachment wp-att-20" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/6/"><img
class="alignnone size-medium wp-image-20" title="6" src="http://icodex.org/wp-content/uploads/2010/02/6-400x171.jpg" alt="" width="400" height="171" /></a></p><p>第五步:<br
/> <a
rel="attachment wp-att-21" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/7/"><img
class="alignnone size-medium wp-image-21" title="7" src="http://icodex.org/wp-content/uploads/2010/02/7-400x156.jpg" alt="" width="400" height="156" /></a></p><p>第六步:<br
/> <a
rel="attachment wp-att-22" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/8/"><img
class="alignnone size-medium wp-image-22" title="8" src="http://icodex.org/wp-content/uploads/2010/02/8-399x195.jpg" alt="" width="399" height="195" /></a></p><p>第七步:<br
/> <a
rel="attachment wp-att-23" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/9/"><img
class="alignnone size-medium wp-image-23" title="9" src="http://icodex.org/wp-content/uploads/2010/02/9-399x158.jpg" alt="" width="399" height="158" /></a></p><p>第八步:<br
/> <a
rel="attachment wp-att-24" href="http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/attachment/10/"><img
class="alignnone size-medium wp-image-24" title="10" src="http://icodex.org/wp-content/uploads/2010/02/10-400x219.jpg" alt="" width="400" height="219" /></a></p><p>最后一步注意要先将这段代码保存为icodex.crt 放在与icodex.csr icodex.key同个目录.</p><p>然后配置nginx,直接丢配置上来.</p><blockquote><p>server {<br
/> listen       443;<br
/> listen       80;<br
/> server_name  os.icodex.org;<br
/> root   /home/icodex/os/public_html;<br
/> index index.html index.htm index.php;<br
/> access_log  /var/log/nginx/os.icodex.org-access.log   access;</p><p>ssl    on;<br
/> ssl_certificate    /etc/nginx/certs/icodex.crt;<br
/> ssl_certificate_key     /etc/nginx/certs/icodex.key;<br
/> ssl_session_timeout 5m;</p><p>ssl_protocols SSLv2 SSLv3 TLSv1;<br
/> ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;<br
/> ssl_prefer_server_ciphers   on;</p><p>location ~* ^.+\.(js|css|jpg|jpeg|gif|png|ico|bmp|swf)$ {<br
/> expires      7d;<br
/> }</p><p># pass the PHP scripts to FastCGI server<br
/> #<br
/> location ~ .*\.php$ {<br
/> fastcgi_index  index.php;<br
/> fastcgi_pass    127.0.0.1:9000;<br
/> include        fastcgi_params;<br
/> <strong>fastcgi_param   HTTPS on;</strong><br
/> }<br
/> }</p></blockquote><p>最后重启nginx.完毕...</p><p>另外,昨日与Showfom(此君 域名我妒忌)聊天的时候谈到火狐中文版验证ssl时提示ssl不受信任的问题,这应该是根证书的问题,后来测试,果然解决了.我们知道在apache有  SSLCertificateChainFile用来指定CA根证书位置,虽然nginx没有这个字段来指定,但是在nginx和lighttpd中是可  以将CA根证书与我们自己的证书合并使用的(声明来源:Sudone).步骤如下:</p><p>我们先到startssl下载 CA根证书,地址:http://cert.startssl.com/certs /,然后进入我们的证书保存位置,注意,操作前记得备份原证书文件.</p><blockquote><p>cd /etc/nginx/certs/<br
/> cp  icodex.crt  icodex.crt.bak<br
/> wget http://www.startssl.com/certs/ca.pem<br
/> cat ca.pem &gt;&gt; icodex.crt</p></blockquote><p>最后重启nginx即可.</p><h2  class="related_post_title">Related Posts</h2><ul
class="related_post"><li><a
href="http://icodex.org/2010/02/nginx%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac-for-cpanel/" title="nginx 自动安装脚本 For cPanel">nginx 自动安装脚本 For cPanel</a> (8)</li></ul>]]></content:encoded> <wfw:commentRss>http://icodex.org/2010/02/%e4%b8%banginx%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%aestartssl%e5%85%8d%e8%b4%b9https%e8%af%81%e4%b9%a6/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>还是喜欢你,WordPress</title><link>http://icodex.org/2010/02/use-wordpress/</link> <comments>http://icodex.org/2010/02/use-wordpress/#comments</comments> <pubDate>Mon, 01 Feb 2010 01:19:09 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[小日子]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://icodex.org/?p=1</guid> <description><![CDATA[哎.发现自己其实也是很没有恒心的,原本打算就用Typecho了,但还是由于诸多的不习惯,还是用WordPress吧.
新春佳节即将到来.预祝朋友们新春愉快,虎年行大运.
Related PostsNo Related Post]]></description> <content:encoded><![CDATA[<p>哎.发现自己其实也是很没有恒心的,原本打算就用Typecho了,但还是由于诸多的不习惯,还是用WordPress吧.</p><p>新春佳节即将到来.预祝朋友们新春愉快,虎年行大运.</p><h2  class="related_post_title">Related Posts</h2><ul
class="related_post"><li>No Related Post</li></ul>]]></content:encoded> <wfw:commentRss>http://icodex.org/2010/02/use-wordpress/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 14/59 queries in 0.047 seconds using disk

Served from: host.evlit.net @ 2010-03-10 19:25:00 -->