瀏覽模式: 普通 | 列表

Apache 使用 mod_php 讓 VH 有獨立的 php.ini 檔

Apache 可以使用 php_admin_flag 或 php_flag 更改 php 的參數值使每個 Virtual HOst 不一樣,

另一種玩法,使每個 php.ini 不一樣,

預設在 phpinfo 裡會看到 Configuration File (php.ini) Path 是在 /etc/php.ini

使用 mod_php 這個模組,就可以讓每一個 Virtual Host 有自已的 php.ini  設定檔

只要這樣

<VirtualHost 1.2.3.4:80>

PHPINIDir /放置路徑/

</VirtualHost>

接著在 /放置路徑/ 裡產生一個 php.ini 就可以了

標籤: apache php.ini

Quote: http://phorum.study-area.org/index.php/topic,55321.0.html

sycross:

比方說 register_globals 預設是 Off,是可以用 .htaccess 設定

php_flag register_globals On

.htaccess 是可以允許使用來修改參數,但如何才可以達到某些參數不被 .htaccess 允許設定,

比方說我要限制 upload_max_filesize 永遠只能夠 2MB,就算 .htaccess 設定了也沒有效,

是可以在 httpd.conf 就設定使用 php_admin_value,因為 php_admin_value 權力比 php_value 大,

但這樣子就比較麻煩了,對多個 virtual host不就要一個一個設定,有其它簡單的方式嗎?

fillano:

偷吃步的方法:在 httpd.conf 裡面加上

[閱讀全文]

標籤: apache htaccess

對 Apache 連線數多個概念

Quote: http://www.systn.com/data/articles/338_tw.html

日期:2008-07-17  作者:喜騰小二  來源:PHPChina




今天說說Apache的最佳化。為什麼要最佳化?因為伺服器資源不夠用。資源有很多方麵,但根據木桶理論,只要有一種資源不夠用,整個伺服器的效能就會受到影響(所謂瓶頸)。

伺服器資源

那麼伺服器的資源包括哪些?對於網站來說主要是CPUTCP連線數這兩者。 CPU表現在工作數上,在Linux下使用平均負載(loadavg)來衡量。可透過以下指令來檢視(參考這篇文章):

cat /proc/loadavg

對於單CPU的伺服器,loadavg高於1,表明工作隊列出現了等待,CPU忙不過來了。超過2以上就會明顯感到效能降低了。

TCP連線數可透過以下指令檢視:

netstat -ant | grep :80 | wc -l

如果要即時監控伺服器資源,可參考OpenNMS項目。

注1:記憶體不算,低廉的價格使得網站伺服器很少有因為記憶體不夠而down掉的。
注2:CPU%是瞬時的CPU使用率,通常無法反映出整體負載。

Apache配置指令

[閱讀全文]

標籤: apache 連線數

Apache 無法在單一IP建置SSL給多個 Virtual Host (name-based)使用,也就是說 SSL 服務只能在 ip-based 底下使用,

Apache 官網 http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#vhosts 說明了一切

Why can't I use SSL with name-based/non-IP-based virtual hosts?
The reason is very technical, and a somewhat "chicken and egg" problem. The SSL protocol layer stays below the HTTP protocol layer and encapsulates HTTP. When an SSL connection (HTTPS) is established Apache/mod_ssl has to negotiate the SSL protocol parameters with the client. For this, mod_ssl has to consult the configuration of the virtual server (for instance it has to look for the cipher suite, the server certificate, etc.). But in order to go to the correct virtual server Apache has to know the Host HTTP header field. To do this, the HTTP request header has to be read. This cannot be done before the SSL handshake is finished, but the information is needed in order to complete the SSL handshake phase. Bingo!
http://help.directadmin.com/item.php?id=89
Why do I need an owned IP for my own SSL certificate? Last Modified: Oct 26, 2005, 3:20 pm
The reason you must have your own IP address when you want to use your own SSL certificate (when you don't want the server wide shared certificate) is because of the way SSL and apache (httpd) works.
For name based webhosting (when many domains are on one IP) the web browser will pass the name of the domain being requested inside the httpd headers along with the request. This way, apache knows which domain you are trying to access even though there are many domains on that one IP address.
When you do the same thing through an SSL connection, the connection has to be made *before* the request can be sent. In this connection, the certificate is passed. The only information that apache knows before the request is made is which IP the connection is being made to. It has to be able to know which certificate to send before the request is made, thus you can't use mutiple certificates on the same IP (if you do, apache will use the first certificate listed which DA will always set to the server shared certificate for shared IPs).
If you want to use your own certificate, it must be the first certificate listed. This wouldn't work for a shared IP, because there would multiple domain wanting this status, and the first certificate would the one shown. For this resaon the shared certificate is always used on a shared IP. For your certificate, DA will aknowledge the IP as being 'owned' and will remove the server shared certificate as the first cert to be loaded, thus your certificate will be loaded instead. 
http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html

[閱讀全文]

標籤: apache ssl

Apache httpd.conf 中的 prefork 及 worker

執行 httpd -l 得知我用的 Multi-Processing Modules(MPMs)是什麼
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
所以我用的 MPMs 是 perfork

1。prefork 使用子程序來提供服務
2。子程序則獨立使用記憶體,且利用檔案與其它子程序溝通
3。比較佔用記憶體, 但相容性及穩定性較佳
4。引用

[閱讀全文]

Apache 模組: 頻寬限制 mod_bw

安裝、使用皆 easy 的不得了,網路上也一堆教學文件,

這樣代表實際限制為 50kb 下載
BandWidth    all 50000
官網: http://apache.ivn.cl/
http://apache.ivn.cl/files/txt/mod_bw-0.8.txt

http://fun.idv.tw/fun/2006/12/apachemod_bw.html

http://blog.wu-boy.com/2007/08/20/119/
http://modules.apache.org/search?id=786

標籤: apache mod_bw

狀況

   1。網站慢
   2。ssh 連線慢

top

attachments/200806/9292256428.jpg

error_log

[閱讀全文]

標籤: apache