Posted in CodeIgniter, Laravel, Nginx, php, Ubuntu on Oct 8th, 2012
相信大家都知道 Nginx 搭配 PHP-FPM 用起來效能還不錯,這次來筆記如何設定 Nginx 去除 PHP MVC Framework 討厭的 index.php 字串,不管是 Laravel 或 CodeIgniter 教學文件都是在 Apache 設定 .htaccess 來達成 Cleaner URL,Apache 最大好處支援 .htaccess,但是 Nginx 也有強大的效能,此篇紀錄如何設定 Nginx 達成 mod_rewrite 效果。
Read Full Post »
Posted in apache, Ubuntu on Jun 30th, 2012
上次寫了一篇 Ubuntu 10.10 (Maverick) 架設 Nginx + PHP FastCGI,不過在 PHP 上傳檔案部份發現了問題,打開 /var/log/apache2/error.log 發現底下錯誤訊息: mod_fcgid: HTTP request length 136000 (so far) exceeds MaxRequestLen (131072) 上網找了一下是 fcgid.conf 設定錯誤,解決方式非常簡單,只要打開 /etc/apache2/mods-available/fcgid.conf,將底下內容
Read Full Post »
Posted in apache, javascript on May 10th, 2012
Apache 可以透過 mod_mime 模組且根據使用者定義的副檔名來 response data 給 Client 端,此功能可以應用在前台搭配 Template Library,例如 Mustache Logic-less templates,透過此 Apache 模組 可以在 html 檔案將定義好全部 Template,一次讀取進來,底下舉個例子: <script type="text/x-mustache-template" data-id="me"> <!–#include file="assets/templates/test1.mustache" –> </script> 我們希望 apache 能夠讀取 assets/templates/test1.mustache,並且將檔案內容放到 script 裡面,這時候就必須在 apache httpd.conf 定義 text/x-mustache-template <ifmodule mime_module> AddType text/x-mustache-template .mustache AddOutputFilter INCLUDES .mustache </ifmodule>
Read Full Post »
Posted in apache, Linux, php, Ubuntu on Mar 17th, 2011
最近想架設 Redmine 在 Ubuntu 伺服器上面,架設之前要先搞定 apache 搭配 mpm worker 及 mod_fcgi module,安裝步驟其實不難,就搭配懶人指令 apt 就可以了。 安裝 apache mpm worker 由於怕安裝過程會叫你把 apache2-mpm-worker 移除,改裝 apache2-mpm-prefork,所以安裝順序上面有些變化,請參考底下: # 先安裝 $ apt-get install apache2.2-bin apache2.2-common apache2-mpm-worker libapache2-mod-fcgid php5-cli php5-cgi php5-common #後安裝 $ apt-get install apache2 php5 php5-gd php5-curl 至於 PHP 5 套件就看你需要什麼就裝什麼吧,搜尋一下 php5-* 看看,apache 裝好預設看不到 PHP 網頁,也就是認不得 php type,請在 apache config [...]
Read Full Post »
Posted in apache, CSS, javascript, jQuery on Aug 23rd, 2010
今年在 COSCUP 大會上最主流的議題就是 Html5,今天看到一個網站 HTML5 Boilerplate,這網站提一個全新 html 5 模板,自從離開 Dreamweaver 樣板軟體,利用 Pspad 手動撰寫 html,此網站就發揮非常大的用處,提供全新 html,CSS 以及 javascript,支援了底下很多功能: 跨瀏覽器 (IE6…) 支援多種 html5 Tag Compress 和 cache html 檔案 CSS IE6 , IE7 Hack IE6 Png Fix (連這個都幫忙解決了) 支援 CDN jQuery,避免在 local 端沒讀取到檔案 你還可以根據自己需要的功能做添加或者是減少,CSS reset、跨瀏覽器 CSS、robots.txt、Apache .htaccess cache 壓縮也有支援,如果不需要的功能,也可以參考看看,對於初學者也是非常好的學習例子。
Read Full Post »
Posted in CodeIgniter, FreeBSD, php, wordpress on Jun 23rd, 2010
昨天升級了 FreeBSD 的 Apache, PHP, and MySQL,遇到很多地雷阿,最多的就是 PHP 的部份,因為本來自己使用 5.2.11 版本,但是在 commit port 的時候發生去裝 5.3.2 版本,所以就直接砍掉全部重練,先是遇到 MySQL 問題,原先在 database/mysql60-server 已經被 FreeBSD 移除,任何關於 mysql60 的相關 port 都被 remove 掉了,只好 downgrade 到 mysql 5.1.48 版本,移除同時順手把 apache PHP 相關都拿掉了。 移除 apache mysql php 相關 ports -rf 依序找尋相關 Mysql ports 移除 pkg_deinstall -rf mysql60-server 接下來安裝 MySQL 5.1.48 Server and [...]
Read Full Post »
Posted in apache, FreeBSD, Linux on Mar 26th, 2010
之前介紹 [FreeBSD]high performance caching reverse proxy: Varnish (安裝架設篇) 來當 Web 前端 Reverse Proxy,也有 load balance 的功能,不過碰到這樣的環境,後端 Apache Server 只會抓到 Reverse Proxy IP 來當作 log 紀錄,而無法正確取得 Client 端 IP,Varnish 官網 FAQ 有提到 log 檔案得的解決方法,不過在程式方面,要大量的修改,假設今天 Apache 跑10個 Virtual Host ,不就要去改10個網站程式,背後或許是一些大型 open source 的 Project,改起來相當不容易,也很費工夫。Darkhero 提供了 reverse proxy add forward module for Apache (mod_rpaf) 模組,只要裝上這模組,Apache 就不必動到其它設定就可以正確紀錄 log 檔案,且程式都不必修改,就可以得到正確 [...]
Read Full Post »
Posted in apache, FreeBSD, Linux, Network, php, www on Mar 21st, 2010
在上禮拜跟 DarkHero 兄聊到 How To Build a Scalable Web Site (3/6) 的上課講義,互相討論了 MySQL Load balance 以及 http reverse proxy 的方式,以前自己有用 HAProxy 當作 Web 平衡負載,順便紀錄了 HAProxy FreeBSD 安裝方式,這次要來介紹今天重點:Varnish Cache Server,在近幾年流行的 Caching 機制,大家會想到 Squid,只要您設定良好的 Squid 參數,它一定運作的非常穩定,然而它的核心依然是 forward proxy,要架設成 Reverse Proxy 還必需要設定一些參數才可以達到,是有一定的困難性,然而 Varnish Cache Server 底層就是高效能 caching reverse proxy,也因為 Squid 是 1980 年發展出來的,程式架構過於老舊,可以參考 ArchitectNotes 瞭解這部份詳情。也許您會問到 Varnish 可以架設成 forward [...]
Read Full Post »
今天把 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,那底下寫一下作法了:
Read Full Post »
Posted in Lighttpd, Linux, www on Jul 22nd, 2008
昨天網站無緣無故被擋掉,原因是我的流量網站太大,囧,因為是架設 web site,測試一下效能,我發現 apache[/url] 沒辦法撐住流量跟線上人數,所以只好換成 Lighttpd[/url] 發現效果不錯,所以又去安裝了 CentOS 版本,我是去參考底下這篇:,這一篇我覺得寫的還ok,但是因為 Centos 如果你想用 yum 安裝 Lighttpd[/url] 就要先裝 rpmforge-release package 這個東西,這樣才可以找到。 首先先看你的版本再來抓: RHEL5 / CentOS-5 i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm RHEL4 / CentOS-4 i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.x86_64.rpm RHEL3 / CentOS-3 i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el3.rf.i386.rpm x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el3.rf.x86_64.rpm RHEL2.1 / CentOS-2 i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el2.rf.i386.rpm
Read Full Post »