You are here: 首頁 文章分類選單 架站小知識

飛朵啦學習手札

本網站建議使用Firefox2.0以上,或是使用Goole瀏覽器來瀏覽,並使用1024x768解析度來觀看.

架站小知識

在某些電腦出現 502 Bad Way

E-mail 列印 PDF

之所以在某些電腦明明是同一支程式,卻有的能成功執行,有的卻出現502 Bad Way ,若是查詢error_log會出現upstream sent too big header while reading response header from upstream.

那問題可能如下。

可以理解成nginx接受client請求時的響應使用的。 proxy是nginx作為client轉發時使用的,如果header過大,超出了默認的1k,就會引發上述的upstream sent too big header。

簡單來說就是cookie攜帶的header太多了

解決方法在nginx.conf(nginx的設置環境)裡的http 裡面加入或修改以下

http {

....

fastcgi_buffer_size 128k;

fastcgi_buffers 8 128k;

proxy_buffer_size  128k;

proxy_buffers   32 32k;

proxy_busy_buffers_size 128k;

最近更新 ( 週二, 12 七月 2022 16:59 )
 
 

CI .htaccess for HiHosting主機

E-mail 列印 PDF

本文轉自http://codeigniter.org.tw/forum/viewtopic.php?f=7&t=3900

 


近期把專案程式 (PHP+CI) 交付到客戶承租的 中華電信HiHosting 主機時,

發現 .htaccess 檔案的關係,導致網頁一直未能正常顯示出來 ( 403 Forbidden Error ),

拜求咕狗大神之後,只要在我們原有的.htaccess 檔多加入 Options +FollowSymLinks 就可以了 ;

後來不經意又看到 SymLinksIfOwnerMatchFollowSymLinks 更安全,但效能也許差一些些,

所以再將之修正為 Options -FollowSymLinks +SymLinksIfOwnerMatch

修正過後的 .htaccess 檔如底下所示:

 

代碼:
# -CodeIgniter- TO REMOVE index.php FROM URL
Options -FollowSymLinks +SymLinksIfOwnerMatch
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]   


總言之,對我手上兩個專案客戶都採用HiNet HiHosting 主機時,須使用上方的 .htaccess 網站才能正常運作;

以上,野人獻曝,若有誤導或者更優的 solution 也請板上前輩們不吝指教,謝謝。


## 參考資料如下 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

◎ 底下摘錄自 Apache ( http://jendo.org/files/doc/apache.html )

代碼:
二、路徑的 Options

Options 的參數,可在參數前加上「+」或「-」。Options屬性如果沒有用「+」或者「-」來增加或者減少一個功能的時候,每個之前定義的Options的所有功能都會被取消,直到你又為它指定一些功能。
且options屬性在整體設定和虛擬主機設定上並不相關,互相不起作用,因為他們在各自的範圍內被重載了。
所以如果要在虛擬主機裡面使用在整體設定中的Options功能,那麼就不要在虛擬主機設定中指定Options功能;而是用「+」或者「-」符號來增加或者減少功能。

Options的諸參數如下:
All: 以下諸功能皆有。
None: 以下諸功能皆無。
Indexes: 自動產生目錄的索引,將Indexes拿掉,點選連結目錄就不會秀出目錄來,會改成403 forbidden的訊息頁面。
Includes: 提供 SSI (Server-Side Inclues) 功能,即使用Apache的指令在html檔中寫程式。須先載入 includes_module 。詳見 http://home.educities.edu.tw/shirock/comp/Apache_SSI.htm 。
FollowSymLinks: 遵循符號鏈接,即能夠連到其它的目錄去執行。會壓過SymLinksIfOwnerMatch。
SymLinksIfOwnerMatch: 對符號鏈接及其每一層父資料夾,都進行權限檢查,當連結檔本身的owner跟連結目的地的owner不同時拒絕存取。
ExecCGI:可以執行CGI程式。
MultiViews: 送出多國語言支援的頁面。此功能必須被明確指定,Options All並不會提供這個功能。




◎ 底下摘錄自 Apache Performance Tuning ( http://httpd.apache.org/docs/2.2/misc/perf-tuning.html )

代碼:
FollowSymLinks and SymLinksIfOwnerMatch
Wherever in your URL-space you do not have an Options FollowSymLinks, or you do have an Options SymLinksIfOwnerMatch
Apache will have to issue extra system calls to check up on symlinks. One extra call per filename component. For example,
if you had:

DocumentRoot /www/htdocs
<Directory />
Options SymLinksIfOwnerMatch
</Directory>

and a request is made for the URI /index.html. Then Apache will perform lstat(2) on /www, /www/htdocs, and /www/htdocs/index.html.
The results of these lstats are never cached, so they will occur on every single request.
If you really desire the symlinks security checking you can do something like this:

DocumentRoot /www/htdocs
<Directory />
Options FollowSymLinks
</Directory>

<Directory /www/htdocs>
Options -FollowSymLinks +SymLinksIfOwnerMatch
</Directory>

This at least avoids the extra checks for the DocumentRoot path. Note that you'll need to add similar sections if you have any Alias
or RewriteRule paths outside of your document root. For highest performance, and no symlink protection,
set FollowSymLinks everywhere, and never set SymLinksIfOwnerMatch.
 
 

vTiger CRM 客戶管理系統相關資訊

E-mail 列印 PDF

vTiger CRM 一套 PHP + MYSQL 的客戶管理系統

官網:https://www.vtiger.com/open-source/

測試網址:http://pim0110.com/vtigerCRM

相關中文資訊:http://summer10920.blogspot.tw/2014/01/vtiger-600.html

 

XAMPP phpmyadmin裡無法查看數據表的結構

E-mail 列印 PDF

最近裝XAMPP發現進phpmyadmin點資料表的結構,就會當掉

並出現[發生嚴重錯誤,您是否要回報錯誤報告?]

主要原因應該在於XAMPP他生到1.8.3之後PHP版本過新

跟phpmyadmin無法兜起來

換成1.8.2後就正常了

 

 

[轉]利用onerror()處理圖片失連時替換顯示圖

E-mail 列印 PDF

以前都像白癡一樣寫成PHP去判斷

或是使用javascript去判斷

但其實可以使用onerror判斷就好了

當src的圖片不存在時,使用onerror的圖片來顯示

<img onerror="this.src='noImg.gif'" src="/joomla/test.jpg" />

當src的圖片不存在時,呼叫函式imgDisplay()

<img src="/joomla/uploadlogo.jpg"  onerror='imgDisplay()' />

 

JAVASCRIPT判斷

<script type="text/javascript">

function imgDisplay()

{

var board = document.getElementById("imgshow");

board.style.display = 'none';

}

</script>

 

轉自:http://demo.tc/Post/285

 
第 1 頁, 共 3 頁