<?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>小惡魔 - 電腦技術 - 生活日記 - 美食介紹 - AppleBOY &#187; Lighttpd</title>
	<atom:link href="http://blog.wu-boy.com/category/%e9%9b%bb%e8%85%a6%e6%8a%80%e8%a1%93/lighttpd-%e9%9b%bb%e8%85%a6%e6%8a%80%e8%a1%93/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wu-boy.com</link>
	<description>介紹一堆美食日記，生活日記，電腦筆記</description>
	<lastBuildDate>Tue, 27 Jul 2010 14:04:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[網站] 好站連結 (二)</title>
		<link>http://blog.wu-boy.com/2009/05/28/1307/</link>
		<comments>http://blog.wu-boy.com/2009/05/28/1307/#comments</comments>
		<pubDate>Thu, 28 May 2009 05:29:35 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[好站連結]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=1307</guid>
		<description><![CDATA[PHP

TimThumb：PHP縮圖程式
如何將 Centos 5.3 php 5.1.6 升級到 php 5.2.9
Installing PHP 5.2.x on RedHat ES5, CentOS 5, etc
<span class="readmore"><a href="http://blog.wu-boy.com/2009/05/28/1307/" title="[網站] 好站連結 (二)" target="_blank">...詳全文（共1281字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><span id="more-1307"></span><br />
PHP</p>
<ul>
<li><a class="entry-title-link" href="http://feedproxy.google.com/%7Er/IdeaGrapes/%7E3/Zrw7YrK7_Wc/" target="_blank">TimThumb：PHP縮圖程式</a></li>
<li><a href="http://gogo2man.world.edoors.com/CeR8uEH5D4xQ" target="_blank">如何將 Centos 5.3 php 5.1.6 升級到 php 5.2.9</a></li>
<li><a rel="bookmark" href="http://bluhaloit.wordpress.com/2008/03/13/installing-php-52x-on-redhat-es5-centos-5-etc/">Installing PHP 5.2.x on RedHat ES5, CentOS 5, etc</a></li>
<li><a title="Permanent Link to &quot;CentOS下用yum 安裝 php+mysql+apache&quot;" rel="bookmark" href="http://blog.24reader.com/vincentlam/2008/08/30/centos%e4%b8%8b%e7%94%a8yum-%e5%ae%89%e8%a3%9d-phpmysqlapache/">CentOS下用yum 安裝 php+mysql+apache</a></li>
<li><a href="http://teethgrinder.co.uk/open-flash-chart/" target="_blank">Open Flash Chart</a></li>
<li><a href="http://www.krahn.org/2009/05/8-good-php-tools-to-create-and-test-web-applications/" target="_blank">8 Good PHP Tools and Libraries to Create and Test Web Applications</a></li>
<li><a href="http://www.unravelthemusic.com/blog/view/9" target="_blank">Partial-page caching with Memcached and PHP in 3 easy steps</a></li>
<li><a href="http://www.phpro.org/examples/Validate-Date-Using-PHP.html" target="_blank">Validate Date Using PHP</a></li>
<li><a href="http://www.phpro.org/examples/Calculate-Age-With-PHP.html">Calculate Age With PHP</a></li>
<li><a title="Permanent Link to a web server in php" rel="bookmark" href="http://www.rawseo.com/news/2009/05/20/a-web-server-in-php/">a web server in php</a></li>
<li><a title="Permanent Link to An ftp server written in PHP" rel="bookmark" href="http://www.rawseo.com/news/2009/05/18/an-ftp-server-written-in-php/">An ftp server written in PHP</a></li>
<li><a title="Permanent Link to How to use the digg API" rel="bookmark" href="http://www.rawseo.com/news/2009/05/06/how-to-use-the-digg-api/">How to use the digg API</a></li>
<li><a title="Permanent Link to How to turn a php script to an exe..for free" rel="bookmark" href="http://www.rawseo.com/news/2009/05/13/how-to-turn-a-php-script-to-an-exefor-free/">How to turn a php script to an exe..for free</a></li>
<li><a title="Permanent Link to 2-way encryption in PHP" rel="bookmark" href="http://www.rawseo.com/news/2009/05/05/2-way-encryption-in-php/">2-way encryption in PHP</a></li>
<li><a title="Permanent Link to Free php library for the google analytics API" rel="bookmark" href="http://www.rawseo.com/news/2009/05/01/free-php-library-for-the-google-analytics-api/">Free php library for the google analytics API</a></li>
</ul>
<p>MySQL</p>
<ul>
<li><a href="http://www.linuxquestions.org/questions/slackware-14/error-install-mysql-initial-database-715576/" target="_blank"><strong>Error install MySql initial database</strong></a></li>
</ul>
<p>WWW</p>
<ul>
<li><a href="http://delayer.pixnet.net/blog/post/23263247">Windows Server 2000/2003 遠端連線只能同時2人連線數問題</a></li>
<li><a href="http://github.com/guides/pull-requests" target="_blank">Git Guides: Pull Requests</a></li>
<li>
<p class="post-title"><a title="Permanent Link to Git 原始碼管理" rel="bookmark" href="http://www.qweruiop.org/nchcrails/posts/49">Git 原始碼管理</a></p>
</li>
<li>
<p class="entry-title"><a class="entry-title-link" href="http://feedproxy.google.com/%7Er/ihower/%7E3/g6yybi2qws0/2620" target="_blank">Git 版本控制系統(2) 開 branch 分支和操作遠端 repo</a></p>
</li>
<li>
<p class="title"><a href="http://plog.longwin.com.tw/my_note-unix/2009/05/15/git-initial-env-setup-2009" target="_blank">Git 基礎設定 (帳號的環境參數設定)</a></p>
</li>
</ul>
<p>jQuery</p>
<ul>
<li><a rel="bookmark" href="http://spaceforaname.com/galleryview">GalleryView 2.0: A jQuery Content Gallery Plugin</a></li>
<li><a href="http://www.logicbox.net/jquery/simplyscroll/">simplyScroll &#8211; A jQuery Plugin</a></li>
<li><a title="Permanent Link to Demystifying the jQuery selectors optimization" rel="bookmark" href="http://www.no-margin-for-errors.com/2009/04/28/demystifying-the-jquery-selectors-optimization/">Demystifying the jQuery selectors optimization</a></li>
<li><a href="http://www.no-margin-for-errors.com/projects/how-to-optimize-jquery-selectors/" target="_blank">How to: Optimize your jQuery selectors</a></li>
<li><a href="http://ithelp.ithome.com.tw/question/10019707" target="_blank">jQuery取Radio的值</a></li>
</ul>
<p>html</p>
<ul>
<li><a href="http://www.iconseeker.com">icon search</a></li>
<li><a href="http://www.iconlet.com">icon let 搜尋小圖</a></li>
<li><a href="http://www.iconlook.com/" target="_blank">icon look 小圖</a></li>
</ul>
<p>FreeBSD</p>
<ul>
<li><a href="http://bojack.pixnet.net/blog/post/23885117" target="_blank">【FreeBSD】LDAP Server &#8211; 安裝篇</a></li>
<li><a href="http://www.cyberciti.biz/faq/freebsd-disable-ps-sockstat-command-information-leakage/">FreeBSD Prevent Users From Seeing Information About Processes Owned by Other Users</a></li>
<li><a href="http://im.nuk.edu.tw/~lee/rrdtool/" target="_blank">FreeBSD RRDtool Tutorial</a></li>
<li><a href="http://im.nuk.edu.tw/~lee/rrdtool/" target="_blank">FreeBSD RRDtool <span style="font-size: x-small;">written by LEE</span></a></li>
</ul>
<p>javascript</p>
<ul>
<li><a class="entry-title-link" href="http://feedproxy.google.com/%7Er/IdeaGrapes/%7E3/gvyR3CJ3Oa0/" target="_blank">多行 JavaScript</a></li>
</ul>
<p>MySQL</p>
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.0/en/explain.html">EXPLAIN Syntax</a></li>
<li><a href="http://www.jpipes.com/index.php?/archives/231-Join-fu-The-Art-of-SQL-Tuning.html">Join-fu: The Art of SQL Tuning</a></li>
<li><a href="http://www.jpipes.com/index.php?/archives/239-Slides-for-Join-Fu-The-Art-of-SQL-I-and-II.html">Slides for Join-Fu: The Art of SQL (I and II)</a></li>
</ul>
<p>Linux</p>
<ul>
<li><a title="Permalink to IRC by IRSSI, with Big5/UTF-8 recode" rel="bookmark" href="http://www.jeffhung.net/blog/articles/jeffhung/742/">IRC by IRSSI, with Big5/UTF-8 recode</a></li>
<li><a href="http://lzy-blah.blogspot.com/2007/08/screen-irssi-irc-q.html">用 screen  + irssi 上 irc 之鄉民版教學 (含Q&amp;A)</a></li>
<li><a class="entry-title-link" href="http://www.krahn.org/2009/05/how-to-install-an-ubuntu-based-web-server/" target="_blank">How to install an Ubuntu based Web Server</a></li>
<li><a class="entry-title-link" href="http://fourdollars.blogspot.com/2009/05/ssh-p-xxxx-usernamehostcom-ssh-host.html" target="_blank">FourDollars: 減少打字 ssh -p xxxx username@host.com -&gt; ssh host</a></li>
<li><a href="http://redmine.lighttpd.net/wiki/lighttpd/Docs:Performance" target="_blank">Lighttpd Description &#8211; Performance Issues</a></li>
<li><a class="entry-title-link" href="http://www.cyberciti.biz/tips/rhel-fedora-centos-debian-ubuntu-lighttpd-mod_rrdtool.html" target="_blank">Lighttpd mod_rrdtool: Monitor The Load, Requests Per Seconds and Traffic</a></li>
</ul>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2009/07/28/1441/" title="[網站] 好站連結 (四)">[網站] 好站連結 (四) (0)</a></li><li><a href="http://blog.wu-boy.com/2009/06/11/1386/" title="[網站] 好站連結 (三)">[網站] 好站連結 (三) (0)</a></li><li><a href="http://blog.wu-boy.com/2006/09/19/16/" title="FreeBSD + Lighttpd + php + mysql 安裝過程">FreeBSD + Lighttpd + php + mysql 安裝過程 (0)</a></li><li><a href="http://blog.wu-boy.com/2010/06/23/2240/" title="[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9">[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9 (0)</a></li><li><a href="http://blog.wu-boy.com/2009/03/09/948/" title="mydumper 取代 mysqldump 效能">mydumper 取代 mysqldump 效能 (1)</a></li><li><a href="http://blog.wu-boy.com/2008/12/30/667/" title="[MySQL] 實做 MySQL Master-Master Replication 同步">[MySQL] 實做 MySQL Master-Master Replication 同步 (0)</a></li><li><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi">[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/293/" title="[轉貼] RoR：Ruby on Rails的部署方案選擇">[轉貼] RoR：Ruby on Rails的部署方案選擇 (0)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/291/" title="[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI">[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI (1)</a></li><li><a href="http://blog.wu-boy.com/2010/07/07/2276/" title="ProFTPD UseEncoding 繁體中文亂碼解決 Localization">ProFTPD UseEncoding 繁體中文亂碼解決 Localization (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2009/05/28/1307/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[網站] 好站連結(一)</title>
		<link>http://blog.wu-boy.com/2009/05/06/1149/</link>
		<comments>http://blog.wu-boy.com/2009/05/06/1149/#comments</comments>
		<pubDate>Wed, 06 May 2009 03:47:58 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[好站連結]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=1149</guid>
		<description><![CDATA[FreeBSD

Hand Book：重新編譯 &#8220;world&#8221;
FreeBSD Security Advisories

Linux
<span class="readmore"><a href="http://blog.wu-boy.com/2009/05/06/1149/" title="[網站] 好站連結(一)" target="_blank">...詳全文（共1161字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><span id="more-1149"></span><br />
<a href="http://www.freebsd.org" target="_blank"><strong>FreeBSD</strong></a></p>
<ul>
<li><a href="http://www.freebsd.org/doc/zh_TW/books/handbook/makeworld.html">Hand Book：重新編譯 &#8220;world&#8221;</a></li>
<li><a href="http://www.freebsd.org/doc/en/books/handbook/security-advisories.html">FreeBSD Security Advisories</a></li>
</ul>
<p>Linux</p>
<ul>
<li><a href="http://kalug.linux.org.tw/">大高雄Linux使用者協會</a></li>
<li><a href="http://code.google.com/p/yasnippet/" target="_blank">Google Code:YASnippet is a template system for emacs</a></li>
</ul>
<p>MySQL</p>
<ul>
<li><a title="Permanent Link to &quot;XtraBackup：線上備份 InnoDB 的好東西&quot;" rel="bookmark" href="http://blog.gslin.org/archives/2009/04/24/2001/">XtraBackup：線上備份 InnoDB 的好東西</a></li>
<li><a href="http://blog.gslin.org/archives/2009/04/23/1999/">MySQL 版號訂「5.4」的原因</a></li>
<li><a href="http://dev.mysql.com/tech-resources/articles/mysql-54.html" target="_blank">A Quick Look at MySQL 5.4</a></li>
<li><a href="http://www.mysqlconf.com/mysql2009/public/schedule/detail/6661" target="_blank">Mastering the Art of Indexing</a></li>
<li><a href="http://tw2.php.net/mysqli.multi-query" target="_blank">mysqli::multi_query</a></li>
</ul>
<p>Python</p>
<ul>
<li><a href="http://larc.ee.nthu.edu.tw/~jcyeh/python/cdoc/tut/tut.html">Python 教學文件</a></li>
<li><a href="http://www.ez2learn.com/index.php/python-tutorials">什麼是Python? Why Python? </a></li>
<li><a href="http://pydev.sourceforge.net/">好用的 IDE tool：Pydev</a></li>
<li><a href="http://blog.finalevil.com/2008/06/google-app-engine-python-django.html">[程式]為了Google App Engine我含淚開始學 Python + django</a></li>
<li><a title="用 Eclipse + PyDev 開發 Google App Engine 的程式" href="http://blog.ericsk.org/archives/889">用 Eclipse + PyDev 開發 Google App Engine 的程式</a></li>
<li><a href="http://docs.djangoproject.com/en/dev/" target="_blank">Django Documentation</a></li>
</ul>
<p>CSS</p>
<ul>
<li><a href="http://developer.yahoo.com/yui/grids/builder/">YUI: CSS Grid Builder</a></li>
<li><a title="Permanent Link: 美化IE中的縮圖" rel="bookmark" href="http://wordsmith.blog.ithome.com.tw/post/1624/23535">美化IE中的縮圖</a></li>
</ul>
<p>Apache</p>
<ul>
<li><a href="http://www.htaccesseditor.com/tc.shtml">線上製作 .htaccess</a></li>
<li><a href="http://blog.linym.net/archives/127">可攜式 APM 網頁伺服器</a></li>
<li><a class="title" rel="bookmark" href="http://blog.linym.net/archives/221">IE 下載 Office 2007 檔案變成 zip</a></li>
<li><a href="http://www.yuanma.org/data/2009/0103/article_3470.htm" target="_blank">lighttpd和apache比較</a></li>
</ul>
<p>PHP</p>
<ul>
<li><a href="http://kohanaphp.com/" target="_blank">Web Framework: Kohana</a></li>
<li><a href="http://codeigniter.com/">Web Framework:CodeIgniter</a></li>
<li><a title="Kohana PHP framework 試玩心得" rel="bookmark" href="http://tzangms.com/programming/1210">Kohana PHP framework 試玩心得</a></li>
<li><a href="http://codeigniter.com/wiki/css/" target="_blank">CodeIgniter 使用 css</a></li>
<li><a href="http://codeigniter.com/forums/viewthread/62527/#307761" target="_blank">CSS and Images with CodeIgniter</a></li>
<li><a href="http://doublekai.org/docs/CI_Install_Guide/CI.html" target="_blank">CodeIgniter 安裝與設定</a></li>
<li><a href="http://doublekai.org/docs/CI_Template/reference.html" target="_blank">A Guide to Using Template for CodeIgniter </a></li>
<li><a title="Permanent Link to 免費PHP線上編輯器–phpanywhere，讓你隨時隨地都能寫程式！" rel="bookmark" href="http://blog.soft.idv.tw/?p=503">免費PHP線上編輯器–phpanywhere，讓你隨時隨地都能寫程式！</a></li>
<li><a href="http://www.jaceju.net/blog/?p=477" target="_blank">[Web] Cookie 小觀念</a></li>
<li><a title="Permanent Link to 將 PEAR 放進 CodeIgniter" rel="bookmark" href="http://doublekai.org/blog/?p=658">將 PEAR 放進 CodeIgniter</a></li>
<li><a href="http://www.jaceju.net/blog/?p=491" target="_blank">[Wacow] 處理 Request 的方式</a></li>
<li><a href="http://bojack.pixnet.net/blog/post/23832296" target="_blank">【程式】利用 PHP 搜尋 LDAP / AD 資訊</a></li>
</ul>
<p>jQuery</p>
<ul>
<li><a href="http://docs.jquery.com/Events/live">jQuery Events/live</a></li>
<li><a class="entry-title-link" href="http://feedproxy.google.com/%7Er/IdeaGrapes/%7E3/SuZvp6rg41Y/" target="_blank">[jQuery] Lazy與Lazy Load</a></li>
<li><a href="http://www.trilancer.com/jpolite/" target="_blank">Lightweight jQuery Portal</a></li>
<li><a href="http://gugod.org/2009/05/javascripts-way-to-know-the-image-size.html" target="_blank">Javascript&#8217;s way to know the image size</a></li>
<li><a href="http://gugod.org/2007/12/jquery-way-to-limit-image-size.html" target="_blank">jquery way to limit image size</a></li>
</ul>
<p>javascript</p>
<ul>
<li><a href="http://www.tkalu.com/blog/2008/10/25/41/" target="_blank">用Javascript實現網站簡繁體轉換</a></li>
</ul>
<p>WWW</p>
<ul>
<li><a title="Permanent Link to 美國主機選購經驗談(一)：購買前要注意的六大警訊" rel="bookmark" href="http://blog.soft.idv.tw/?p=497">美國主機選購經驗談(一)：購買前要注意的六大警訊</a></li>
<li><a title="Permanent Link to 美國主機選購經驗談(二)：如何找到又快又好的虛擬主機?" rel="bookmark" href="http://blog.soft.idv.tw/?p=498">美國主機選購經驗談(二)：如何找到又快又好的虛擬主機?</a></li>
<li><a title="Permanent Link to 美國主機選購經驗談(三)：四大類主機術語規格大解密" rel="bookmark" href="http://blog.soft.idv.tw/?p=500">美國主機選購經驗談(三)：四大類主機術語規格大解密</a></li>
<li><a href="http://plog.longwin.com.tw/my_note/2009/04/20/osdc-note-2009" target="_blank">OSDC (Open Source Developers&#8217; Conference) 2009 筆記整理</a></li>
<li><a class="entry-title-link" href="http://feedproxy.google.com/%7Er/IdeaGrapes/%7E3/kT9md1Z4IJk/" target="_blank">介紹短網址服務：u.nu及其API</a></li>
<li><a href="http://www.rejetto.com/hfs/?f=intro">HFS ~ Http File Server</a></li>
<li><a href="http://www.acme.com/software/http_load/" target="_blank">http_load &#8211; multiprocessing http test client</a></li>
<li><a href="http://blog.longwin.com.tw/archives/000513.html" target="_blank">Apache 壓力測試 ab</a></li>
<li><a href="http://plog.longwin.com.tw/my-favorite-site/2009/04/30/favorite-web-page-history-2009" target="_blank">網頁歷史資料庫存</a></li>
<li><a href="http://www.weithenn.idv.tw/cgi-bin/wiki.pl/NVIDIA%E9%A9%85%E5%8B%95%E9%80%A0%E6%88%90%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8%E9%81%A0%E7%AB%AF%E6%A1%8C%E9%9D%A2%E9%80%A3%E7%B7%9A" target="_blank">NVIDIA驅動造成無法使用遠端桌面連線</a></li>
</ul>
<p>html</p>
<ul>
<li><a href="http://www.htmlcodetutorial.com/forms/_INPUT_TABINDEX.html" target="_blank">HTML TABINDEX &#8211; HTML Code Tutorial</a></li>
</ul>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2009/11/05/1698/" title="[網站] 好站連結 (六)">[網站] 好站連結 (六) (0)</a></li><li><a href="http://blog.wu-boy.com/2009/09/29/1551/" title="[網站] 好站連結 (五)">[網站] 好站連結 (五) (3)</a></li><li><a href="http://blog.wu-boy.com/2009/07/28/1441/" title="[網站] 好站連結 (四)">[網站] 好站連結 (四) (0)</a></li><li><a href="http://blog.wu-boy.com/2009/06/11/1386/" title="[網站] 好站連結 (三)">[網站] 好站連結 (三) (0)</a></li><li><a href="http://blog.wu-boy.com/2009/05/28/1307/" title="[網站] 好站連結 (二)">[網站] 好站連結 (二) (3)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2009/05/06/1149/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi</title>
		<link>http://blog.wu-boy.com/2008/09/13/388/</link>
		<comments>http://blog.wu-boy.com/2008/09/13/388/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 12:24:26 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[電腦技術]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[php-cgi]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=388</guid>
		<description><![CDATA[今天把 FreeBSD web 改成了 apache worker 其實之前就已經這麼做了，只是今天加上 mod_fastcgi 我是參考 DarkKiller 大神 apache22 (worker) + mod_fastcgi + php5-fcgi，之前就把 Server 換成了 php5-fcgi，只不過我是搭配 Lighttpd，效能方面還不錯，可以參考這篇：[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI，那因為用 lighttpd 的外掛模組真的太少，不像 apache 支援這麼多 module，重點是還缺少了 .htaccess 這個功能，所以大大降低大家使用 lighttpd，近期內會把全部 server 換成 apache2 搭配 mod_fastcgi，那底下寫一下作法了：
<span class="readmore"><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi" target="_blank">...詳全文（共1956字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天把 <a href="http://www.freebsd.org">FreeBSD</a> web 改成了 <a href="http://www.apache.org/">apache</a> <a href="http://httpd.apache.org/docs/2.0/mod/worker.html">worker</a> 其實之前就已經這麼做了，只是今天加上 mod_fastcgi 我是參考 <a href="http://blog.gslin.org/archives/2008/08/17/1624/">DarkKiller 大神 apache22 (worker) + mod_fastcgi + php5-fcgi</a>，之前就把 Server 換成了 php5-fcgi，只不過我是搭配 <a href="http://www.lighttpd.net/">Lighttpd</a>，效能方面還不錯，可以參考這篇：<a href="http://blog.wu-boy.com/2008/07/10/291/">[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI</a>，那因為用 <a href="http://www.lighttpd.net/">lighttpd</a> 的外掛模組真的太少，不像 apache 支援這麼多 module，重點是還缺少了 .htaccess 這個功能，所以大大降低大家使用 <a href="http://www.lighttpd.net/">lighttpd</a>，近期內會把全部 server 換成 apache2 搭配 <a href="http://www.fastcgi.com/">mod_fastcgi</a>，那底下寫一下作法了：<br />
<span id="more-388"></span><br />
基本上利用 FreeBSD 的 ports 安裝就可以了：<br />
1. 先安裝 apache with MPM = worker</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw3">cd</span> <span class="sy0">/</span>usr<span class="sy0">/</span>ports<span class="sy0">/</span>www<span class="sy0">/</span>apache22<br />
<span class="kw2">make</span> <span class="re2">WITH_MPM</span>=worker <span class="kw2">install</span> clean <br />
pkg_info <span class="sy0">|</span> <span class="kw2">grep</span> apache<br />
<span class="co0">#</span><br />
<span class="co0"># 會出現</span><br />
<span class="co0">#</span><br />
apache-worker-2.2.9_5 Version 2.2.x of Apache web server with worker MPM.</div></div>
<p>2. 安裝 PHP5 跟 PHP5-extensions</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw3">cd</span> <span class="sy0">/</span>usr<span class="sy0">/</span>ports<span class="sy0">/</span>lang<span class="sy0">/</span>php5; <span class="kw2">make</span> <span class="kw2">install</span> clean<br />
<span class="kw3">cd</span> <span class="sy0">/</span>usr<span class="sy0">/</span>ports<span class="sy0">/</span>lang<span class="sy0">/</span>php5-extensions; <span class="kw2">make</span> <span class="kw2">install</span> clean</div></div>
<p>3. 安裝 mod_fastcgi</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw3">cd</span> <span class="sy0">/</span>usr<span class="sy0">/</span>ports<span class="sy0">/</span>www<span class="sy0">/</span>mod_fastcgi<br />
<span class="kw2">make</span> <span class="kw2">install</span> clean</div></div>
<p>全部安裝完成，先修改 httpd.conf</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 把下面這行 umark 掉</span><br />
<span class="co0">#</span><br />
<span class="co0"># Server-pool management (MPM specific)</span><br />
Include etc<span class="sy0">/</span>apache22<span class="sy0">/</span>extra<span class="sy0">/</span>httpd-mpm.conf</div></div>
<p>修改 Include etc/apache22/extra/httpd-mpm.conf<br />
mpm_worker_module 那段：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace">ThreadLimit <span class="nu0">512</span><br />
&nbsp; &nbsp; StartServers <span class="nu0">1</span><br />
&nbsp; &nbsp; MaxClients <span class="nu0">512</span><br />
&nbsp; &nbsp; MinSpareThreads <span class="nu0">1</span><br />
&nbsp; &nbsp; MaxSpareThreads <span class="nu0">512</span><br />
&nbsp; &nbsp; ThreadsPerChild <span class="nu0">512</span><br />
&nbsp; &nbsp; MaxRequestsPerChild <span class="nu0">0</span></div></div>
<p>這樣 MPM worker 就設定完成了，接下來設定 mod_fastcgi</p>
<p>到 /usr/local/etc/apache22/httpd.conf 把底下這一段的註解拿掉</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace">LoadModule fastcgi_module &nbsp; &nbsp; libexec<span class="sy0">/</span>apache22<span class="sy0">/</span>mod_fastcgi.so</div></div>
<p>新增設定檔：/usr/local/etc/apache22/Includes/fastcgi.conf，內容如下：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
FastCgiConfig <span class="re5">-maxClassProcesses</span> <span class="nu0">1</span><br />
ScriptAlias <span class="sy0">/</span>fcgi-bin<span class="sy0">/</span> <span class="st0">&quot;/usr/local/www/fcgi-bin/&quot;</span><br />
<span class="sy0">&lt;</span>Directory <span class="sy0">/</span>usr<span class="sy0">/</span><span class="kw3">local</span><span class="sy0">/</span>www<span class="sy0">/</span>fcgi-bin<span class="sy0">/&gt;</span><br />
&nbsp; &nbsp; SetHandler fastcgi-script<br />
&nbsp; &nbsp; AllowOverride All<br />
&nbsp; &nbsp; Order allow,deny<br />
&nbsp; &nbsp; Allow from all<br />
<span class="sy0">&lt;/</span>Directory<span class="sy0">&gt;</span><br />
<span class="co0">#</span><br />
AddHandler php-fastcgi .php<br />
Action php-fastcgi <span class="sy0">/</span>fcgi-bin<span class="sy0">/</span>php</div></div>
<p>這裡設定只能跑一隻 <a href="http://www.fastcgi.com">fastcgi</a> 配合前面的 MPM worker，這樣確保所有的 apache 只會透過這個 fastcgi socket 跑 php。<br />
然後再建立： /usr/local/www/fcgi-bin 這個資料夾，裡面擺入執行檔 php 內容是：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#!/bin/sh</span><br />
<span class="re2">PHPRC</span>=<span class="st0">&quot;/usr/local/etc&quot;</span><br />
<span class="kw3">export</span> PHPRC<br />
<span class="re2">PHP_FCGI_CHILDREN</span>=<span class="nu0">128</span><br />
<span class="kw3">export</span> PHP_FCGI_CHILDREN<br />
<span class="kw3">exec</span> <span class="sy0">/</span>usr<span class="sy0">/</span><span class="kw3">local</span><span class="sy0">/</span>bin<span class="sy0">/</span>php-cgi</div></div>
<p>之後在安裝 <a href="http://pecl.php.net/package/APC">APC</a> (<a href="http://www.freshports.org/www/pecl-APC/">www/pecl-APC</a>)  這樣就可以了，底下引述 gslin 的講解：</p>
<blockquote><p>這個架構下，httpd 會產生 512 threads 處理連線，並產生一個 fastcgi 的 socket 處理 PHP 程式，這個 socket 會由 128 隻 php-cgi 聽，且這 128 隻的 cache 會共用。</p></blockquote>
<p>參考網站：<a href="http://blog.gslin.org/">gslin 大神</a> ：<a href="http://blog.gslin.org/archives/2008/08/17/1624/">apache22 (worker) + mod_fastcgi + php5-fcgi</a></p>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2008/07/22/297/" title="[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator">[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/291/" title="[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI">[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI (1)</a></li><li><a href="http://blog.wu-boy.com/2008/07/01/286/" title="[FreeBSD]Apache 噴出 signal Segmentation fault (11)">[FreeBSD]Apache 噴出 signal Segmentation fault (11) (1)</a></li><li><a href="http://blog.wu-boy.com/2008/06/05/275/" title="[FreeBSD] 安裝 PHP APC 加速網頁速度">[FreeBSD] 安裝 PHP APC 加速網頁速度 (2)</a></li><li><a href="http://blog.wu-boy.com/2010/06/23/2240/" title="[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9">[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9 (0)</a></li><li><a href="http://blog.wu-boy.com/2009/06/11/1386/" title="[網站] 好站連結 (三)">[網站] 好站連結 (三) (0)</a></li><li><a href="http://blog.wu-boy.com/2009/02/23/829/" title="[FreeBSD] 利用 portmaster 升級 PHP 5.26 -> 5.28">[FreeBSD] 利用 portmaster 升級 PHP 5.26 -> 5.28 (2)</a></li><li><a href="http://blog.wu-boy.com/2008/07/03/287/" title="[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write">[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write (1)</a></li><li><a href="http://blog.wu-boy.com/2008/06/23/283/" title="[FreeBSD &#038; Linux]網站分流：簡易架設 HAProxy 伺服器">[FreeBSD &#038; Linux]網站分流：簡易架設 HAProxy 伺服器 (1)</a></li><li><a href="http://blog.wu-boy.com/2007/01/22/64/" title="[apache] mod cband 頻寬限制">[apache] mod cband 頻寬限制 (3)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2008/09/13/388/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator</title>
		<link>http://blog.wu-boy.com/2008/07/22/297/</link>
		<comments>http://blog.wu-boy.com/2008/07/22/297/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 07:56:09 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[eaccelerator]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=297</guid>
		<description><![CDATA[昨天網站無緣無故被擋掉，原因是我的流量網站太大，囧，因為是架設 web site，測試一下效能，我發現 [url=http://httpd.apache.org/]apache[/url] 沒辦法撐住流量跟線上人數，所以只好換成 [url=http://www.lighttpd.net/]Lighttpd[/url] 發現效果不錯，所以又去安裝了 CentOS 版本，我是去參考底下這篇：[url=http://www.howtoforge.com/lighttpd_php5_mysql_centos5.0]Installing Lighttpd With PHP5 And MySQL Support On CentOS 5.0[/url]，這一篇我覺得寫的還ok，但是因為 Centos 如果你想用 yum 安裝 [url=http://www.lighttpd.net/]Lighttpd[/url] 就要先裝 rpmforge-release package 這個東西，這樣才可以找到。
<span class="readmore"><a href="http://blog.wu-boy.com/2008/07/22/297/" title="[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator" target="_blank">...詳全文（共3141字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>昨天網站無緣無故被擋掉，原因是我的流量網站太大，囧，因為是架設 web site，測試一下效能，我發現 [url=http://httpd.apache.org/]apache[/url] 沒辦法撐住流量跟線上人數，所以只好換成 [url=http://www.lighttpd.net/]Lighttpd[/url] 發現效果不錯，所以又去安裝了 CentOS 版本，我是去參考底下這篇：[url=http://www.howtoforge.com/lighttpd_php5_mysql_centos5.0]Installing Lighttpd With PHP5 And MySQL Support On CentOS 5.0[/url]，這一篇我覺得寫的還ok，但是因為 Centos 如果你想用 yum 安裝 [url=http://www.lighttpd.net/]Lighttpd[/url] 就要先裝 rpmforge-release package 這個東西，這樣才可以找到。</p>
<p>首先先看你的版本再來抓：</p>
<blockquote><p>RHEL5 / CentOS-5<br />
i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm </p>
<p>x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm </p>
<p>RHEL4 / CentOS-4<br />
i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm </p>
<p>x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.x86_64.rpm </p>
<p>RHEL3 / CentOS-3<br />
i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el3.rf.i386.rpm </p>
<p>x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el3.rf.x86_64.rpm </p>
<p>RHEL2.1 / CentOS-2<br />
i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el2.rf.i386.rpm </p></blockquote>
<p><span id="more-297"></span><br />
就是找你的版本，然後下載安裝：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 安裝</span><br />
<span class="co0">#</span><br />
<span class="kw2">wget</span> http:<span class="sy0">//</span>packages.sw.be<span class="sy0">/</span>rpmforge-release<span class="sy0">/</span>rpmforge-release-0.3.6-1.el5.rf.i386.rpm <br />
rpm <span class="re5">-ivh</span> rpmforge-release-0.3.6-1.el5.rf.i386.rpm</div></div>
<p>安裝 lighttpd</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># yum 安裝</span><br />
<span class="co0">#</span><br />
yum <span class="kw2">install</span> lighttpd<br />
yum <span class="kw2">install</span> lighttpd-fastcgi php-cli</div></div>
<p>然後編輯：/etc/php.ini 加上</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace">cgi.fix_pathinfo = <span class="nu0">1</span></div></div>
<p>然後修改 lighttpd.conf</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 修改</span><br />
<span class="co0">#</span><br />
<span class="kw2">vi</span> <span class="sy0">/</span>etc<span class="sy0">/</span>lighttpd<span class="sy0">/</span>lighttpd.conf</div></div>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace">server.modules &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= <span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_rewrite&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_redirect&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_alias&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_access&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_fastcgi&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_proxy&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_evhost&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_userdir&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;mod_accesslog&quot;</span> <span class="br0">&#41;</span><br />
<br />
server.document-root &nbsp; &nbsp; &nbsp; &nbsp;= <span class="st0">&quot;/var/www/html/&quot;</span><br />
<br />
server.errorlog &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&quot;/var/log/lighttpd/error.log&quot;</span><br />
<br />
index-file.names &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= <span class="br0">&#40;</span> <span class="st0">&quot;index.php&quot;</span>, <span class="st0">&quot;index.html&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;index.htm&quot;</span>, <span class="st0">&quot;default.htm&quot;</span> <span class="br0">&#41;</span><br />
fastcgi.server &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="br0">&#40;</span> <span class="st0">&quot;.php&quot;</span> =<span class="sy0">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span> <span class="st0">&quot;localhost&quot;</span> =<span class="sy0">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;socket&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/tmp/php-fastcgi.socket&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;bin-path&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/usr/bin/php-cgi&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span><br />
<span class="re1">$HTTP</span><span class="br0">&#91;</span><span class="st0">&quot;host&quot;</span><span class="br0">&#93;</span> == <span class="st0">&quot;mini101.twgg.org&quot;</span> <span class="br0">&#123;</span><br />
&nbsp; server.document-root = <span class="st0">&quot;/var/www/html/Mini/&quot;</span><br />
&nbsp; <span class="co0">#url.rewrite = ( &quot;^/(archives|categories|comments|feed)/&quot; =&gt; &quot;/index.php&quot; )</span><br />
&nbsp; url.rewrite = <span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;^/?$&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/index.php&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;^/(\?.*)$&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/index.php$1&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;^/(wp-.+)$&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;$0&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;^/([^.]+)/?$&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/index.php?$1&quot;</span>,<br />
&nbsp; <span class="br0">&#41;</span><br />
&nbsp; accesslog.filename = <span class="st0">&quot;/var/log/lighttpd/mini101.twgg.org-access_log&quot;</span><br />
<span class="br0">&#125;</span></div></div>
<p>安裝：eaccelerator</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># yum 安裝</span><br />
<span class="co0">#</span><br />
yum <span class="kw2">install</span> eaccelerator</div></div>
<p>設定 eaccelerator.ini</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 編輯</span><br />
<span class="co0">#</span><br />
<span class="kw2">vi</span> <span class="sy0">/</span>etc<span class="sy0">/</span>php.d<span class="sy0">/</span>eaccelerator.ini<br />
<span class="co0">#</span><br />
; Enable eAccelerator extension module<br />
zend_extension = <span class="sy0">/</span>usr<span class="sy0">/</span>lib<span class="sy0">/</span>php<span class="sy0">/</span>modules<span class="sy0">/</span>eaccelerator.so<br />
; Options <span class="kw1">for</span> the eAccelerator module<br />
eaccelerator.cache_dir = <span class="sy0">/</span>var<span class="sy0">/</span>cache<span class="sy0">/</span>php-eaccelerator<br />
eaccelerator.shm_size = <span class="nu0">128</span><br />
eaccelerator.enable = <span class="nu0">1</span><br />
eaccelerator.optimizer = <span class="nu0">1</span><br />
eaccelerator.check_mtime = <span class="nu0">1</span><br />
eaccelerator.filter = <span class="st0">&quot;&quot;</span><br />
eaccelerator.shm_max = <span class="nu0">0</span><br />
eaccelerator.shm_ttl = <span class="nu0">3600</span><br />
eaccelerator.shm_prune_period = <span class="nu0">0</span><br />
eaccelerator.shm_only = <span class="nu0">0</span><br />
eaccelerator.compress = <span class="nu0">1</span><br />
eaccelerator.compress_level = <span class="nu0">9</span><br />
eaccelerator.keys = <span class="st0">&quot;shm_and_disk&quot;</span><br />
eaccelerator.sessions = <span class="st0">&quot;shm_and_disk&quot;</span><br />
eaccelerator.content = <span class="st0">&quot;shm_and_disk&quot;</span><br />
eaccelerator.debug = <span class="nu0">0</span></div></div>
<p>這樣大概ok了，然後測試看看：<br />
# php -v</p>
<blockquote><p>PHP 5.1.6 (cli) (built: Sep 20 2007 10:16:10)<br />
Copyright (c) 1997-2006 The PHP Group<br />
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies<br />
    with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator</p></blockquote>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi">[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/291/" title="[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI">[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI (1)</a></li><li><a href="http://blog.wu-boy.com/2008/07/03/287/" title="[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write">[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write (1)</a></li><li><a href="http://blog.wu-boy.com/2008/07/01/286/" title="[FreeBSD]Apache 噴出 signal Segmentation fault (11)">[FreeBSD]Apache 噴出 signal Segmentation fault (11) (1)</a></li><li><a href="http://blog.wu-boy.com/2008/06/05/275/" title="[FreeBSD] 安裝 PHP APC 加速網頁速度">[FreeBSD] 安裝 PHP APC 加速網頁速度 (2)</a></li><li><a href="http://blog.wu-boy.com/2010/06/23/2240/" title="[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9">[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9 (0)</a></li><li><a href="http://blog.wu-boy.com/2010/03/21/2054/" title="[FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇)">[FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇) (8)</a></li><li><a href="http://blog.wu-boy.com/2009/09/08/1646/" title="[RHEL]Installing PHP 5.1.x 5.2.x or 5.3.x on RedHat ES5, CentOS 5">[RHEL]Installing PHP 5.1.x 5.2.x or 5.3.x on RedHat ES5, CentOS 5 (0)</a></li><li><a href="http://blog.wu-boy.com/2009/07/28/1441/" title="[網站] 好站連結 (四)">[網站] 好站連結 (四) (0)</a></li><li><a href="http://blog.wu-boy.com/2009/06/11/1386/" title="[網站] 好站連結 (三)">[網站] 好站連結 (三) (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2008/07/22/297/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid</title>
		<link>http://blog.wu-boy.com/2008/07/15/294/</link>
		<comments>http://blog.wu-boy.com/2008/07/15/294/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 12:45:04 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=294</guid>
		<description><![CDATA[最近都在找如何增加 WEB 效能的方式，大概找一下 Squid Reverse Proxy 跟 Apache Reverse Proxy，底下是一些文件，大概網路上找到的，整理一下
Apache2 as a Reverse Proxy
<span class="readmore"><a href="http://blog.wu-boy.com/2008/07/15/294/" title="[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid" target="_blank">...詳全文（共204字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近都在找如何增加 WEB 效能的方式，大概找一下 Squid Reverse Proxy 跟 Apache Reverse Proxy，底下是一些文件，大概網路上找到的，整理一下</p>
<p><a href="http://peterkim.hellpara.org/blog/?p=356">Apache2 as a Reverse Proxy</a><br />
<a href="http://lightyror.wordpress.com/2006/12/30/ruby-on-rails-%E4%BC%BA%E6%9C%8D%E5%99%A8%E6%9E%B6%E8%A8%AD%E5%8E%9F%E7%90%86/">ruby-on-rails-伺服器架設原理</a><br />
<a href="http://www.study-area.org/tips/r-proxy_20030117.txt">R-Proxy &#8211; 使用Apache架設</a><br />
<a href="http://www.lccnet.com.tw/commercial/e-paper/200803/new-5.html">使用 Reverse Proxy代理服務</a><br />
<a href="http://www.mysqlperformanceblog.com/2008/06/17/lighttpd-as-reverse-proxy/">Lighttpd as reverse proxy</a><br />
<a href="http://www.visolve.com/squid/whitepapers/reverseproxy.php">Reverse Proxy Using Squid</a></p>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2008/07/10/291/" title="[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI">[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI (1)</a></li><li><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi">[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/22/297/" title="[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator">[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/293/" title="[轉貼] RoR：Ruby on Rails的部署方案選擇">[轉貼] RoR：Ruby on Rails的部署方案選擇 (0)</a></li><li><a href="http://blog.wu-boy.com/2008/07/03/287/" title="[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write">[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write (1)</a></li><li><a href="http://blog.wu-boy.com/2010/06/23/2240/" title="[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9">[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9 (0)</a></li><li><a href="http://blog.wu-boy.com/2010/05/20/2163/" title="[Ubuntu/Debian] 使用系統設定全域 http Proxy">[Ubuntu/Debian] 使用系統設定全域 http Proxy (0)</a></li><li><a href="http://blog.wu-boy.com/2010/03/26/2087/" title="Apache 取得透過 Reverse Proxy (Varnish) 的 Client 真正 IP (mod_rpaf)">Apache 取得透過 Reverse Proxy (Varnish) 的 Client 真正 IP (mod_rpaf) (0)</a></li><li><a href="http://blog.wu-boy.com/2010/03/21/2054/" title="[FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇)">[FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇) (8)</a></li><li><a href="http://blog.wu-boy.com/2009/05/28/1307/" title="[網站] 好站連結 (二)">[網站] 好站連結 (二) (3)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2008/07/15/294/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[轉貼] RoR：Ruby on Rails的部署方案選擇</title>
		<link>http://blog.wu-boy.com/2008/07/10/293/</link>
		<comments>http://blog.wu-boy.com/2008/07/10/293/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 02:04:01 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[HAProxy]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[litespeed]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=293</guid>
		<description><![CDATA[我沒在玩 Ruby on Rails，但是底下這一篇我覺得寫的不錯，可以參考看看，裡面有介紹一下目前當紅 web daemon 的一些基本知識
RoR的部署方式從架構上來說分為前端和後端：
一、前端
<span class="readmore"><a href="http://blog.wu-boy.com/2008/07/10/293/" title="[轉貼] RoR：Ruby on Rails的部署方案選擇" target="_blank">...詳全文（共2506字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>我沒在玩 <a href="http://www.rubyonrails.org/">Ruby on Rails</a>，但是底下這一篇我覺得寫的不錯，可以參考看看，裡面有介紹一下目前當紅 web daemon 的一些基本知識</p>
<blockquote><p>RoR的部署方式從架構上來說分為前端和後端：</p>
<p>一、前端<br />
前端的作用就是處理靜態資源，將動態請求分發到後端，有時候也帶有一些額外的功能，例如對特定URL進行rewrite和redirect，對HTTP輸出進行gzip壓縮等等。</p>
<p>前端目前已知的可以選擇apache, lighttpd, litespeed, nginx, haproxy</p>
<p>1、apache2.2<br />
apache是全球市場佔有率最高的web server，超過全球互聯網網站50%的網站都用apache。apache2.2 + mod_proxy_balancer是一個非常流行，非常穩定的方案。</p>
<p>使用apache2.2唯一的問題就是apache的性能和後面那些輕量級web server相比，差太遠了。一方面在處理靜態請求方面apache要比lighttpd慢3-5倍，內存消耗和CPU消耗也高出一個數量級，另一方面 mod_proxy_balancer的分發性能也不高，比haproxy差很遠。</p>
<p>2、lighttpd<br />
lighttpd 是一個輕量級高性能web server，一個在MySQL Inc工作的德國人寫的。性能很好，內存和CPU資源消耗很低，支持絕大多數apache的功能，是apache的絕好替代者。目前lighttpd已經上升到全球互聯網第四大web server，市場佔有率僅此於apache，IIS和Sun。</p>
<p>lighttpd唯一的問題是proxy功能不完善，因此不適合搭配mongrel來使用。lighttpd下一個版本1.5.0的proxy模塊重寫過了，將會解決這個問題。</p>
<p>3、litespeed<br />
和 lighttpd差不多，商業產品，收費的。比lighttpd來說，多一個web管理界面，不用寫配置文件了。litespeed專門為單機運行的 RoR開發了一個lsapi協議，號稱性能最好，比httpd和fcgi都要好。他的proxy功能比lighttpd完善。</p>
<p>litespeed 的缺點我卻認為恰恰是這個lsapi。因為lsapi不是web server啟動的時候啟動固定數目的ruby進程，而是根據請求繁忙程度，動態創建和銷毀ruby進程，貌似節省資源，實則和apache2.2進程模型一樣，留下很大的黑客攻擊漏洞。只要黑客瞬時發起大量動態請求，就會讓服務器忙於創建ruby進程而導致CPU資源耗盡，失去響應。</p>
<p>當然，litespeed也支持httpd和fcgi，這個和lighttpd用法一樣的，到沒有這種問題。</p>
<p>4、nginx<br />
一個俄國人開發的輕量級高性能web server，特點是做proxy性能很好，因此被推薦取代apache2.2的mod_proxy_balancer，來和mongrel cluster搭配。其他方面和lighttpd到差不多。</p>
<p>要說缺點，可能就是發展的時間比較短，至今沒有正式版本，還是beta版。沒有經過足夠網站的驗證。</p>
<p>5、haproxy<br />
就是一個純粹的高性能proxy，不處理靜態資源的，所有請求統統分發到後端。</p>
<p>二、後端<br />
後端就是跑ruby進程，處理RoR動態請求了。運行後端ruby進程有兩種方式：</p>
<p>1、fcgi方式<br />
準確的說，不能叫做fcgi方式，其實就是啟動一個ruby進程，讓這個ruby進程監聽一個tcp/unix socket，以fcgi協議和前端通訊。所以fcgi不是指ruby進程的運行方式，而是ruby進程使用的通訊協議。這就好比你tomcat可以用 http也可以使用ajp通訊一樣，tomcat自己的運行方式都一樣的，只是通訊方式不一樣。</p>
<p>fcgi方式啟動ruby進程，可以使用lighttpd帶的一個spawn-fcgi工具來啟動(JavaEye目前採用這種方式)。</p>
<p>值得一提的是，apache2.2的mod_fastcgi的方式和上面還不太一樣，由apache動態創建fcgi進程和管理fcgi進程，這種方式和 litespeed的lsapi面臨的問題是一樣的，此外apache的mod_fastcgi自己也有很多嚴重的bug，是一種很糟糕的部署方式。這種糟糕的部署方式也敗壞了fcgi的名聲。</p>
<p>fastcgi只是一種協議，雖然古老，但並不是不好用，http協議也很古老。沒有必要因為 apache的mod_fastcgi的運行方式的問題而連帶把fastcgi都一同否定了。fastcgi只是一個協議(程序之間的語言)，是 apache的mod_fastcgi這個模塊有問題。打個比方，有個人英語水平很差，和你用英語對話，總是結結巴巴的，那你說是英語(fastcgi) 這種語言有問題呢？還是和你對話的這個人 (mod_fastcgi)有問題呢？</p>
<p>2、http方式<br />
也就是用mongrel去跑ruby進程，由於mongrel實際上已經是一個簡單的http server，所以也可以單獨作為web server使用。mongrel現在越來越受歡迎了。</p>
<p>用fcgi方式還是http方式，我個人覺得區別不大，關鍵還是看應用的場合，一般而言，推薦的搭配是：</p>
<p>lighttpd ＋ fcgi 或者 nginx ＋mongrel，而apache因為性能差距，而不被推薦。</p>
<p>JavaEye為什麼用lighttpd ＋ fcgi呢？原因如下：</p>
<p>1) lighttpd發展了好幾年了，市場佔有率也相當高，是一個經過實踐檢驗的server，它的文檔也很全；而nginx還沒有經過足夠的市場檢驗，文檔也很缺乏<br />
2) JavaEye的ruby進程和web server在一台機器上面跑，通過unix socket使用fcgi協議通訊可以避免tcp的網絡開銷，其通訊速度比使用tcp socket使用http協議通訊要快一些。</p>
<p>什麼場合使用haproxy？</p>
<p>大規模部署，例如你的RoR應用到十幾台服務器上面去，你用haproxy會更好，可以方便的添加刪除應用服務器節點，proxy性能更好。</p></blockquote>
<p>資料來源：<br />
Csdn &#8211; http://news.csdn.net/n/20071229/112274.html</p>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2010/06/23/2240/" title="[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9">[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9 (0)</a></li><li><a href="http://blog.wu-boy.com/2010/03/21/2054/" title="[FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇)">[FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇) (8)</a></li><li><a href="http://blog.wu-boy.com/2009/05/28/1307/" title="[網站] 好站連結 (二)">[網站] 好站連結 (二) (3)</a></li><li><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi">[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/22/297/" title="[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator">[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/15/294/" title="[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid">[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid (0)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/291/" title="[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI">[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI (1)</a></li><li><a href="http://blog.wu-boy.com/2008/07/03/287/" title="[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write">[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write (1)</a></li><li><a href="http://blog.wu-boy.com/2008/06/23/283/" title="[FreeBSD &#038; Linux]網站分流：簡易架設 HAProxy 伺服器">[FreeBSD &#038; Linux]網站分流：簡易架設 HAProxy 伺服器 (1)</a></li><li><a href="http://blog.wu-boy.com/2008/06/18/281/" title="基本優化 tuning apache 跟 tuning mysql 跟 php 效能 ">基本優化 tuning apache 跟 tuning mysql 跟 php 效能  (5)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2008/07/10/293/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI</title>
		<link>http://blog.wu-boy.com/2008/07/10/291/</link>
		<comments>http://blog.wu-boy.com/2008/07/10/291/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 01:51:23 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=291</guid>
		<description><![CDATA[最近一直在玩 Lighttpd 這一套 web 的 daemon，我覺得這一套還蠻好用的，不像 Apache 掛載這麼多 module 結果吃還蠻大的資源，加上 Apache 預設跑 MPM prefork 所以如果大型網站大概就會掛掉，線上人數一堆，就會快撐不住了，所以用 MPM worker 或者是 MPM Event，然後 Lighttpd 本身還支援 mod_rewrite 的功能，可以參考我之前寫的 [FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks 問題，不過最近遇到一個很奇怪問題，那就是 Lighttpd 會自己掛點，但是我看 message 跟 error log 底下是：
<span class="readmore"><a href="http://blog.wu-boy.com/2008/07/10/291/" title="[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI" target="_blank">...詳全文（共1834字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近一直在玩 <a href="http://www.lighttpd.net/">Lighttpd</a> 這一套 web 的 daemon，我覺得這一套還蠻好用的，不像 Apache 掛載這麼多 module 結果吃還蠻大的資源，加上 Apache 預設跑 MPM prefork 所以如果大型網站大概就會掛掉，線上人數一堆，就會快撐不住了，所以用 <a href="http://httpd.apache.org/docs/2.0/mod/worker.html">MPM worker</a> 或者是 <a href="http://httpd.apache.org/docs/2.2/mod/event.html">MPM Event</a>，然後 <a href="http://www.lighttpd.net/">Lighttpd</a> 本身還支援 <a href="http://trac.lighttpd.net/trac/wiki/Docs%3AModRewrite">mod_rewrite</a> 的功能，可以參考我之前寫的 <a href="http://blog.wu-boy.com/2008/07/03/287/">[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks 問題</a>，不過最近遇到一個很奇怪問題，那就是 <a href="http://www.lighttpd.net/">Lighttpd</a> 會自己掛點，但是我看 message 跟 error log 底下是：</p>
<blockquote><p>2008-07-10 09:08:31: (server.c.1258) NOTE: a request for /wp-includes/js/scriptaculous/effects.js?ver=1.8.0 timed out after writing 32991 bytes. We waited 360 seconds. If this a problem increase server.max-write-idle</p></blockquote>
<p><span id="more-291"></span><br />
我發現，這個問題是還好，不過我參考了 <a href="http://blog.gslin.org">gaslin 大神</a>的這一篇<a href="http://blog.gslin.org/archives/2007/01/18/1020/">lighttpd + FastCGI + PHP 時的問題</a>，裡面提到FastCGI 跑 TCP socket 比較沒問題，但是用 UNIX 的 socket 會比較有問題，那我也參考了 <a href="http://www.lighttpd.net/">Lighttpd</a> 的 Wiki 上用 <a href="http://trac.lighttpd.net/trac/wiki/fastcgi-php-starter-for-freebsd">Handy External Spawning FastCGI PHP Processes in FreeBSD</a> 這篇所提供的 script，下去跑，最近還在看看結果如何，那大致上作法如下：</p>
<p>1. 把  <a href='http://blog.wu-boy.com/wp-content/uploads/2008/07/fastcgi-php.sh'>fastcgi-php.sh</a> 下載到 /usr/local/etc/rc.d/ 裡面<br />
2. 按到底下步驟</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 下面幾乎不用改</span><br />
<span class="co0">#</span><br />
<span class="kw3">cd</span> <span class="sy0">/</span>usr<span class="sy0">/</span><span class="kw3">local</span><span class="sy0">/</span>etc<span class="sy0">/</span>rc.d<span class="sy0">/</span><br />
<span class="kw2">chown</span> root:wheel fastcgi-php.sh<br />
<span class="kw2">chmod</span> <span class="nu0">544</span> fastcgi-php.sh<br />
<span class="kw2">mkdir</span> <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>fcgiphp<br />
<span class="kw2">chown</span> www:www <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>fcgiphp</div></div>
<p>3. 設定 /etc/rc.conf</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 基本 rc.conf 設定</span><br />
<span class="co0">#</span><br />
<span class="co0"># 開機啟動</span><br />
<span class="re2">fcgiphp_enable</span>=<span class="st0">&quot;YES&quot;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
<span class="co0"># fast-cgi 指令 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><br />
<span class="re2">fcgiphp_bin_path</span>=<span class="st0">&quot;/usr/local/bin/php-cgi&quot;</span> &nbsp; &nbsp;<br />
<span class="re2">fcgiphp_user</span>=<span class="st0">&quot;www&quot;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="re2">fcgiphp_group</span>=<span class="st0">&quot;www&quot;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
<span class="re2">fcgiphp_children</span>=<span class="st0">&quot;10&quot;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
<span class="re2">fcgiphp_port</span>=<span class="st0">&quot;8002&quot;</span><br />
<span class="co0"># 如果你要用 tcp socket 的話，那就是把 下面清空 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><br />
<span class="re2">fcgiphp_socket</span>=<span class="st0">&quot;&quot;</span> &nbsp; <br />
<span class="re2">fcgiphp_env</span>=<span class="st0">&quot;SHELL PATH USER&quot;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
<span class="re2">fcgiphp_max_requests</span>=<span class="st0">&quot;500&quot;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="re2">fcgiphp_addr</span>=<span class="st0">&quot;localhost&quot;</span></div></div>
<p>4. 啟動 fast-cgi</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0"># /usr/local/etc/rc.d/fastcgi-php.sh start</span><br />
Starting fcgiphp.<br />
<span class="co0"># /usr/local/etc/rc.d/fastcgi-php.sh stop</span><br />
Stopping fcgiphp.<br />
<span class="co0"># /usr/local/etc/rc.d/fastcgi-php.sh restart</span><br />
Stopping fcgiphp.<br />
Starting fcgiphp.</div></div>
<p>5. 修改 Lighttpd.conf</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace">fastcgi.server &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="br0">&#40;</span> <span class="st0">&quot;.php&quot;</span> =<span class="sy0">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span> <span class="st0">&quot;localhost&quot;</span> =<span class="sy0">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;host&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;127.0.0.1&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;port&quot;</span> =<span class="sy0">&gt;</span> <span class="nu0">8002</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;bin-path&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/usr/local/bin/php-cgi&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span></div></div>
<p>這樣大致上完成了。</p>
<p>介紹一下 <a href="http://www.lighttpd.net/">Lighttpd</a> 的 <a href="http://trac.lighttpd.net/trac/wiki/Docs%3AModProxy">mod_proxy</a> 功能，目前把圖片存放到另外一台，然後用 proxy 的功能導過去</p>
<p>設定如下：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="re1">$HTTP</span><span class="br0">&#91;</span><span class="st0">&quot;host&quot;</span><span class="br0">&#93;</span> == <span class="st0">&quot;pic.wu-boy.com&quot;</span> <span class="br0">&#123;</span><br />
&nbsp; accesslog.filename = <span class="st0">&quot;/var/log/lighttpd/pic.wu-boy.com-access_log&quot;</span><br />
&nbsp; proxy.server = <span class="br0">&#40;</span> <span class="st0">&quot;&quot;</span> =<span class="sy0">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span> <span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;host&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;140.123.107.54&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;port&quot;</span> =<span class="sy0">&gt;</span> <span class="nu0">80</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span> <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span><br />
<span class="br0">&#125;</span></div></div>
<p>這樣就可以達到你想要的功能了</p>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi">[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/22/297/" title="[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator">[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/15/294/" title="[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid">[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid (0)</a></li><li><a href="http://blog.wu-boy.com/2008/07/01/286/" title="[FreeBSD]Apache 噴出 signal Segmentation fault (11)">[FreeBSD]Apache 噴出 signal Segmentation fault (11) (1)</a></li><li><a href="http://blog.wu-boy.com/2008/06/23/283/" title="[FreeBSD &#038; Linux]網站分流：簡易架設 HAProxy 伺服器">[FreeBSD &#038; Linux]網站分流：簡易架設 HAProxy 伺服器 (1)</a></li><li><a href="http://blog.wu-boy.com/2008/06/05/275/" title="[FreeBSD] 安裝 PHP APC 加速網頁速度">[FreeBSD] 安裝 PHP APC 加速網頁速度 (2)</a></li><li><a href="http://blog.wu-boy.com/2007/01/22/64/" title="[apache] mod cband 頻寬限制">[apache] mod cband 頻寬限制 (3)</a></li><li><a href="http://blog.wu-boy.com/2010/06/23/2240/" title="[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9">[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9 (0)</a></li><li><a href="http://blog.wu-boy.com/2010/03/26/2087/" title="Apache 取得透過 Reverse Proxy (Varnish) 的 Client 真正 IP (mod_rpaf)">Apache 取得透過 Reverse Proxy (Varnish) 的 Client 真正 IP (mod_rpaf) (0)</a></li><li><a href="http://blog.wu-boy.com/2010/03/16/2050/" title="[Vim] 想套用 *.php syntax 顏色於 *.ros">[Vim] 想套用 *.php syntax 顏色於 *.ros (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2008/07/10/291/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[FreeBSD]解決 lighttpd log Permission denied 問題</title>
		<link>http://blog.wu-boy.com/2008/07/04/289/</link>
		<comments>http://blog.wu-boy.com/2008/07/04/289/#comments</comments>
		<pubDate>Fri, 04 Jul 2008 04:01:59 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[log]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=289</guid>
		<description><![CDATA[今天早上伺服器 lighttpd 沒有跑起來，發現是因為沒有寫入 lighttpd.access.log 的權限，所以造成不能啟動
2008-07-04 08:37:15: (mod_accesslog.c.535) opening access-log failed: Permission denied /var/log/lighttpd/lighttpd.access.log
<span class="readmore"><a href="http://blog.wu-boy.com/2008/07/04/289/" title="[FreeBSD]解決 lighttpd log Permission denied 問題" target="_blank">...詳全文（共1043字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天早上伺服器 lighttpd 沒有跑起來，發現是因為沒有寫入 lighttpd.access.log 的權限，所以造成不能啟動</p>
<blockquote><p>2008-07-04 08:37:15: (mod_accesslog.c.535) opening access-log failed: Permission denied /var/log/lighttpd/lighttpd.access.log</p></blockquote>
<p>目前的解法大概就是不能去改 /var/log 這個資料夾權限，所以我在 /var/log 底下新增 lighttpd 這個資料夾<br />
<span id="more-289"></span></p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 新增 lighttpd 資料夾</span><br />
<span class="co0">#</span><br />
<span class="kw2">mkdir</span> <span class="re5">-p</span> <span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>lighttpd<br />
<span class="co0">#</span><br />
<span class="co0"># 改變權限</span><br />
<span class="co0">#</span><br />
<span class="kw2">chown</span> <span class="re5">-R</span> www:www <span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>lighttpd</div></div>
<p>接下來就是 log 檔案會每日增大，所以必須靠 newsyslog 來幫忙了，首先當然就是要去設定 newsyslog.conf</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0"># logfilename &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[owner:group] &nbsp; &nbsp;mode count size when &nbsp;flags [/pid_file] [sig_num]</span><br />
<span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>lighttpd<span class="sy0">/</span>lighttpd.access.log &nbsp;www:www &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="nu0">644</span> &nbsp;<span class="nu0">7</span> &nbsp; &nbsp; <span class="sy0">*</span> &nbsp; &nbsp;<span class="sy0">@</span>T00 &nbsp;JC &nbsp; &nbsp;<span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>lighttpd.pid</div></div>
<p>/var/log/lighttpd/lighttpd.access.log 這就是你要每天定期備份的 log 檔案<br />
www:www 這個檔案擁有者，這個必須設定，不然 lighttpd 就不能讓你啟動，因為系統 rotate log 之後，權限會變成 root<br />
644 這個不用說了吧，檔案權限<br />
7 這個就是檔案數量了喔，大概備份7天<br />
* size 大小，因為我設定每天備份，所以不限制大小了喔<br />
@T00 這就是每天晚上12點進行備份</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="re1">$D0</span> &nbsp; &nbsp; rotate every night at midnight <span class="br0">&#40;</span>same <span class="kw2">as</span> <span class="sy0">@</span>T00<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re1">$D23</span> &nbsp; &nbsp;rotate every day at <span class="nu0">23</span>:00 <span class="br0">&#40;</span>same <span class="kw2">as</span> <span class="sy0">@</span>T23<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re1">$W0D23</span> &nbsp;rotate every week on Sunday at <span class="nu0">23</span>:00<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re1">$W5D16</span> &nbsp;rotate every week on Friday at <span class="nu0">16</span>:00</div></div>
<p>上面是 man 寫的，很清楚吧，這樣設定之後，大概就沒什麼問題了，剩下就是重新啟動服務</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 重新啟動服務 </span><br />
<span class="co0">#</span><br />
<span class="sy0">/</span>etc<span class="sy0">/</span>rc.d<span class="sy0">/</span>newsyslog restart<br />
<span class="sy0">/</span>etc<span class="sy0">/</span>rc.d<span class="sy0">/</span>syslogd restart</div></div>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2009/05/28/1307/" title="[網站] 好站連結 (二)">[網站] 好站連結 (二) (3)</a></li><li><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi">[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/22/297/" title="[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator">[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/15/294/" title="[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid">[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid (0)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/293/" title="[轉貼] RoR：Ruby on Rails的部署方案選擇">[轉貼] RoR：Ruby on Rails的部署方案選擇 (0)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/291/" title="[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI">[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI (1)</a></li><li><a href="http://blog.wu-boy.com/2008/07/03/287/" title="[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write">[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write (1)</a></li><li><a href="http://blog.wu-boy.com/2006/09/19/16/" title="FreeBSD + Lighttpd + php + mysql 安裝過程">FreeBSD + Lighttpd + php + mysql 安裝過程 (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2008/07/04/289/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write</title>
		<link>http://blog.wu-boy.com/2008/07/03/287/</link>
		<comments>http://blog.wu-boy.com/2008/07/03/287/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 08:55:50 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[lighttpd]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/?p=287</guid>
		<description><![CDATA[今天轉換跑道了，最近玩 Apache 玩的很不順，因為只要線上人數一多，就會吃很多記憶體，導致必須重新開 Apache，所以今天來玩看看 lighttpd試試看，看看結果如何，其實轉換到 lighttpd 需要注意很多事情，那就是 Lighttpd 並不支援 .htaccess 檔案，所以 mode_rewrite 功能要設定到 Lighttpd.conf 裡面，然後也去找看看 Lighttpd 的 virtual host 的寫法，然後還有一點就是 wordpress 的 Permalinks 的問題，算是今天都解決了，底下來寫一下作法：
<span class="readmore"><a href="http://blog.wu-boy.com/2008/07/03/287/" title="[FreeBSD]Lighttpd + php5 + 解決 wordpress Permalinks mod_write" target="_blank">...詳全文（共2359字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天轉換跑道了，最近玩 Apache 玩的很不順，因為只要線上人數一多，就會吃很多記憶體，導致必須重新開 Apache，所以今天來玩看看 <a href="http://www.lighttpd.net/">lighttpd</a>試試看，看看結果如何，其實轉換到 <a href="http://www.lighttpd.net/">lighttpd</a> 需要注意很多事情，那就是 Lighttpd 並不支援 .htaccess 檔案，所以 mode_rewrite 功能要設定到 Lighttpd.conf 裡面，然後也去找看看 Lighttpd 的 virtual host 的寫法，然後還有一點就是 wordpress 的 Permalinks 的問題，算是今天都解決了，底下來寫一下作法：</p>
<p><span id="more-287"></span></p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 安裝 lighttpd</span><br />
<span class="co0">#</span><br />
<span class="kw3">cd</span> <span class="sy0">/</span>usr<span class="sy0">/</span>ports<span class="sy0">/</span>www<span class="sy0">/</span>lighttpd; <span class="kw2">make</span> <span class="kw2">install</span> clean<br />
<span class="co0">#</span><br />
<span class="co0"># 安裝 php5</span><br />
<span class="co0">#</span><br />
<span class="kw3">cd</span> <span class="sy0">/</span>usr<span class="sy0">/</span>ports<span class="sy0">/</span>lang<span class="sy0">/</span>php5; <span class="kw2">make</span> <span class="kw2">install</span> clean<br />
<span class="co0">#</span><br />
<span class="co0"># 記得把 [X] FASTCGI &nbsp; &nbsp;Enable fastcgi support (CGI only) 打勾</span><br />
<span class="co0">#</span></div></div>
<p>不然會出現底下錯誤訊息：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="nu0">2008</span>-07-03 <span class="nu0">10</span>:<span class="nu0">44</span>:06: <span class="br0">&#40;</span>mod_fastcgi.c.1036<span class="br0">&#41;</span> If you<span class="st_h">'re trying to run PHP as a FastCGI backend, make sure you'</span>re using the &nbsp; FastCGI-enabled version.<br />
You can <span class="kw2">find</span> out <span class="kw1">if</span> it is the right one by executing <span class="st_h">'php -v'</span> and it should display <span class="st_h">'(cgi-fcgi)'</span> <span class="kw1">in</span> the output, NOT &nbsp; &nbsp; &nbsp;<span class="st_h">'(cgi)'</span> NOR <span class="st_h">'(cli)'</span>.</div></div>
<p>底下是 php-cgi -v</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace">PHP 5.2.6 with Suhosin-Patch 0.9.6.2 <span class="br0">&#40;</span>cgi-fcgi<span class="br0">&#41;</span> <span class="br0">&#40;</span>built: Jul &nbsp;<span class="nu0">3</span> <span class="nu0">2008</span> <span class="nu0">10</span>:<span class="nu0">49</span>:<span class="nu0">48</span><span class="br0">&#41;</span><br />
Copyright <span class="br0">&#40;</span>c<span class="br0">&#41;</span> <span class="nu0">1997</span>-<span class="nu0">2008</span> The PHP Group<br />
Zend Engine v2.2.0, Copyright <span class="br0">&#40;</span>c<span class="br0">&#41;</span> <span class="nu0">1998</span>-<span class="nu0">2008</span> Zend Technologies</div></div>
<p>那如果你沒有支援的話，那就是在 update php5</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 利用 portupgrade 指令</span><br />
<span class="co0">#</span><br />
portupgrade <span class="re5">-rf</span> php5-5.2.6</div></div>
<p>裝好之後呢，其實就差不多了，接下來就是設定 Lighttpd.conf 部份，這部份比較複雜一點，那可以參考官網所提供的說明：<a href="http://trac.lighttpd.net/trac/wiki/Docs">lighttpd wiki</a>，那其實我要做到的就是在web上面擋圖片盜連的功能，所以需要用到 <a href="http://trac.lighttpd.net/trac/wiki/Docs%3AModRewrite">mod_rewrite</a> 的功能，在 apache 作法相當簡單，可以在本站搜尋一下就一堆了，那網路上也很多，那我底下就是在 lighttpd 上面的寫法：</p>
<p>1.首先解決 apache virtual host 的問題：設定如下：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#</span><br />
<span class="co0"># 其實看起來不難，設定 log檔案</span><br />
<span class="co0">#</span><br />
<span class="re1">$HTTP</span><span class="br0">&#91;</span><span class="st0">&quot;host&quot;</span><span class="br0">&#93;</span> == <span class="st0">&quot;www.ee.ccu.edu.tw&quot;</span> <span class="br0">&#123;</span><br />
&nbsp; server.document-root = <span class="st0">&quot;/usr/local/www/apache22/data/www.ee.ccu.edu.tw/&quot;</span><br />
&nbsp; server.errorlog = <span class="st0">&quot;/var/log/lighttpd/www.ee.ccu.edu.tw-error_log&quot;</span><br />
&nbsp; accesslog.filename = <span class="st0">&quot;/var/log/lighttpd/www.ee.ccu.edu.tw-access_log&quot;</span><br />
&nbsp; server.error-handler-<span class="nu0">404</span> = <span class="st0">&quot;/index.php&quot;</span><br />
<span class="br0">&#125;</span></div></div>
<p>log檔案，最好是自己建立一個 lighttpd 的目錄，不然根本沒有權限啟動 lighttpd</p>
<p>2.解決 wordpress 的 Permalinks 的問題：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="re1">$HTTP</span><span class="br0">&#91;</span><span class="st0">&quot;host&quot;</span><span class="br0">&#93;</span> == <span class="st0">&quot;blog.wu-boy.com&quot;</span> <span class="br0">&#123;</span><br />
&nbsp; server.document-root = <span class="st0">&quot;/usr/local/www/apache22/data/Blog/&quot;</span><br />
&nbsp; url.rewrite = <span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;^/?$&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/index.php&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;^/(\?.*)$&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/index.php$1&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;^/(wp-.+)$&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;$0&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;^/([^.]+)/?$&quot;</span> =<span class="sy0">&gt;</span> <span class="st0">&quot;/index.php?$1&quot;</span>,<br />
&nbsp; <span class="br0">&#41;</span><br />
&nbsp; server.errorlog = <span class="st0">&quot;/var/log/lighttpd/blog.wu-boy.com-error_log&quot;</span><br />
&nbsp; accesslog.filename = <span class="st0">&quot;/var/log/lighttpd/blog.wu-boy.com-access_log&quot;</span><br />
<span class="br0">&#125;</span></div></div>
<p>這設定相當簡單，大家可以參考看看</p>
<p>3.解決圖片防止盜連的問題：</p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:580px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="re1">$HTTP</span><span class="br0">&#91;</span><span class="st0">&quot;referer&quot;</span><span class="br0">&#93;</span> <span class="sy0">!</span>~ <span class="st0">&quot;^($|http://(.*\.wu-boy\.com|mini101\.twgg\.org))&quot;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; url.access-deny = <span class="br0">&#40;</span> <span class="st0">&quot;.JPG&quot;</span>, <span class="st0">&quot;.JPEG&quot;</span>, <span class="st0">&quot;.PNG&quot;</span> , <span class="st0">&quot;.GIF&quot;</span> , <span class="st0">&quot;.jpg&quot;</span> , <span class="st0">&quot;.jpeg&quot;</span> , <span class="st0">&quot;.png&quot;</span> , <span class="st0">&quot;.gif&quot;</span><span class="br0">&#41;</span><br />
&nbsp; <span class="br0">&#125;</span></div></div>
<p>這就是要比對 referer 的網址了，其實這樣就可以達到我想要的結果了，可是 lighttpd 好像沒有像是 apache 可以吐出盜連的圖片，也就是把 403 導向一張圖片，lighttpd 好像只可以導向哪一個網頁，這部份還要查查看。</p>
<p><a href="http://www.howtoforge.com/lighttpd_php5_mysql_centos5.0">Installing Lighttpd With PHP5 And MySQL Support On CentOS 5.0 </a><br />
<a href="http://www.weithenn.idv.tw/cgi-bin/wiki.pl/Lighttpd-%E8%BC%95%E9%87%8F%E7%B4%9A_Web_Server ">Lighttpd-輕量級 Web Server</a><br />
<a href="http://blog.gslin.org/archives/2006/09/28/753/">gslin 大大：在 lighttpd 上擋圖片盜連</a><br />
<a href="http://lightyror.wordpress.com/2006/09/27/lighttpd-%E9%98%B2%E6%AD%A2%E5%9C%96%E7%89%87%E7%9B%9C%E9%80%A3/">Lighttpd 防止圖片盜連</a><br />
<a href="http://tzangms.com/blog/lighttpd/1055">lighttpd rewrite rules for Wordpress permalink</a></p>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi">[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi (3)</a></li><li><a href="http://blog.wu-boy.com/2008/07/22/297/" title="[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator">[Linux] CentOS 5.1 安裝 Lighttpd + PHP5 + FastCgi + eaccelerator (3)</a></li><li><a href="http://blog.wu-boy.com/2010/06/23/2240/" title="[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9">[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9 (0)</a></li><li><a href="http://blog.wu-boy.com/2010/03/21/2054/" title="[FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇)">[FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇) (8)</a></li><li><a href="http://blog.wu-boy.com/2009/10/22/1745/" title="Wordpress 2.8.5 Hardening Release">Wordpress 2.8.5 Hardening Release (1)</a></li><li><a href="http://blog.wu-boy.com/2008/07/15/294/" title="[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid">[文件]Reverse Proxy 一些資料 for Apache Lighttpd Squid (0)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/293/" title="[轉貼] RoR：Ruby on Rails的部署方案選擇">[轉貼] RoR：Ruby on Rails的部署方案選擇 (0)</a></li><li><a href="http://blog.wu-boy.com/2008/07/10/291/" title="[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI">[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI (1)</a></li><li><a href="http://blog.wu-boy.com/2008/07/01/286/" title="[FreeBSD]Apache 噴出 signal Segmentation fault (11)">[FreeBSD]Apache 噴出 signal Segmentation fault (11) (1)</a></li><li><a href="http://blog.wu-boy.com/2008/06/18/281/" title="基本優化 tuning apache 跟 tuning mysql 跟 php 效能 ">基本優化 tuning apache 跟 tuning mysql 跟 php 效能  (5)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2008/07/03/287/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FreeBSD + Lighttpd + php + mysql 安裝過程</title>
		<link>http://blog.wu-boy.com/2006/09/19/16/</link>
		<comments>http://blog.wu-boy.com/2006/09/19/16/#comments</comments>
		<pubDate>Wed, 20 Sep 2006 01:57:13 +0000</pubDate>
		<dc:creator>appleboy</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.wu-boy.com/2006/09/19/16/</guid>
		<description><![CDATA[http://gslin.org/2004/10/12/61/
]]></description>
			<content:encoded><![CDATA[<p>系統環境 ：FreeBSD 6.0-RELEASE</p>
<p>安裝過程如下：</p>
<ol>
<li>mysql-server-5.0.24a</li>
<li>php5-5.1.6</li>
<li>lighttpd-1.4.11_1</li>
</ol>
<p>先安裝 <a title="lighttpd" href="http://www.lighttpd.net/">lighttpd</a></p>
<blockquote>
<p>cd /usr/ports/www/lighttpd/</p>
<p>make config</p>
<p>[X] OPENSSL   Enable SSL support<br />
[ ] OPENLDAP  Enable LDAP support<br />
[X] MYSQL     Enable MYSQL support<br />
[X] IPV6      Enable IPV6 support<br />
[X] CML       Enable Cache Meta Language support<br />
make install clean</p>
</blockquote>
<p>安裝 <a title="mysql" href="http://www.mysql.com/">mysql</a></p>
<p>cd /usr/ports/databases/mysql50-server</p>
<p>make install clean WITH_CHARSET=utf8 WITH_LINUXTHREADS=yes</p>
<p>安裝 <a title="php" href="http://www.php.net">php</a></p>
<p>cd /usr/ports/lang/php5<br />
<a target="_blank" href="http://photobucket.com/"><img src="http://i108.photobucket.com/albums/n5/appleboy46/blog/1.gif" /><br />
</a></p>
<p>cd /usr/ports/lang/php5-extensions/</p>
<p>make config</p>
<p>選擇你想要的 extensions</p>
<p>灌好之後 就可以用了  然後打開</p>
<p><strong>家目錄設定</strong></p>
<p>userdir.path = &#8220;public_html&#8221;<br />
userdir.basepath = &#8220;/home/&#8221;</p>
<p>重點來了 如果執行網頁</p>
<p>http://localhost/phpinfo.php 出現 550 error</p>
<p>則你忘記執行fastcgi</p>
<p>php-cgi -v</p>
<p>PHP 5.1.6 (<strong>cgi-fcgi</strong>) (built: Sep 19 2006 22:42:28) (DEBUG)<br />
Copyright (c) 1997-2006 The PHP Group<br />
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies<br />
然後執行</p>
<p>php-cgi -b 127.0.0.1:81 &#038;</p>
<p>即可  port部份 隨機bind一個即可</p>
<p><a id="p83" href="http://blog.wu-boy.com/wp-content/uploads/2007/03/lighttpd.txt">lighttpd 設定檔</a></p>
<h3>Related View</h3><ul class="related_post"><li><a href="http://blog.wu-boy.com/2010/06/23/2240/" title="[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9">[FreeBSD] update apache -> 2.2.15, PHP -> 5.3.2, and MySQL downgrade to 5.1.9 (0)</a></li><li><a href="http://blog.wu-boy.com/2009/05/28/1307/" title="[網站] 好站連結 (二)">[網站] 好站連結 (二) (3)</a></li><li><a href="http://blog.wu-boy.com/2008/09/13/388/" title="[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi">[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi (3)</a></li><li><a href="http://blog.wu-boy.com/2009/11/03/1781/" title="[Perl&#038;PHP] time() and Class::Date 日期轉換運算">[Perl&#038;PHP] time() and Class::Date 日期轉換運算 (1)</a></li><li><a href="http://blog.wu-boy.com/2009/10/18/1729/" title="[講義]屏科大 PHP &#038; MySQL 基礎教學投影片">[講義]屏科大 PHP &#038; MySQL 基礎教學投影片 (11)</a></li><li><a href="http://blog.wu-boy.com/2009/10/09/1716/" title="利用 PHP MySQL Quota-Tool 來限制 MySQL 存取空間大小">利用 PHP MySQL Quota-Tool 來限制 MySQL 存取空間大小 (3)</a></li><li><a href="http://blog.wu-boy.com/2009/08/31/1620/" title="[FreeBSD] 取得 FreeBSD CVSUP 的更新狀態">[FreeBSD] 取得 FreeBSD CVSUP 的更新狀態 (2)</a></li><li><a href="http://blog.wu-boy.com/2009/07/28/1441/" title="[網站] 好站連結 (四)">[網站] 好站連結 (四) (0)</a></li><li><a href="http://blog.wu-boy.com/2009/07/15/1504/" title="[SQL] MySQL ROW_NUMBER Simulation ">[SQL] MySQL ROW_NUMBER Simulation  (0)</a></li><li><a href="http://blog.wu-boy.com/2009/06/20/1466/" title="[PHP] FreeBSD Sphinx 繁體中文全文檢索 on PHP">[PHP] FreeBSD Sphinx 繁體中文全文檢索 on PHP (12)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.wu-boy.com/2006/09/19/16/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
