Apache最佳化深入

來源:互聯網
上載者:User

標籤:訪問   ons   dir   symlink   code   command   reserve   eth   nod   

**壓力測試 [[email protected] ~]# which ab
/usr/bin/ab

ab -n2000 -c800 www.benet.com/index.html

//發送2000請求,並發串連800

可以關閉壓縮功能,觀察測壓結果
**
Apache工作模式

event模式(預設) 查看工作模式 cd /usr/local/httpd/bin
./httpd -l
yum install lsof -y

**lsof -i :80

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 2266 root 3u IPv4 15838 0t0 TCP 192.168.100.101:http (LISTEN)
httpd 2267 daemon 3u IPv4 15838 0t0 TCP 192.168.100.101:http (LISTEN)
httpd 2268 daemon 3u IPv4 15838 0t0 TCP 192.168.100.101:http (LISTEN)
httpd 2269 daemon 3u IPv4 15838 0t0 TCP 192.168.100.101:http (LISTEN)

一個root主進程帶有多個daemon子進程**

prefork模式
./configure \
--prefix=/usr/local/httpd \
--enable-deflate \
--with-mpm=prefork \
--enable-expires \
--enable-so \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi

**vim /etc/httpd.conf
Include conf/extra/httpd-mpm.conf

vim /usr/local/httpd/conf/extra/httpd-mpm.conf
<IfModule mpm_prefork_module>
StartServers 10 # 啟動時進程數
MinSpareServers 10 # 最小空閑進程數
MaxSpareServers 50 # 最大空閑進程數
MaxRequestWorkers 150 #最大並發進程數
MaxConnectionsPerChild 0 # 最大串連數限制
</IfModule>**

worker模式
./configure \
--prefix=/usr/local/httpd \
--enable-deflate \
--with-mpm=worker \
--enable-expires \
--enable-so \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi

**vim /etc/httpd.conf
Include conf/extra/httpd-mpm.conf

<IfModule mpm_worker_module>
StartServers 2 #啟動時進程數
MinSpareThreads 25 #最小空閑線程數
MaxSpareThreads 75 #最大空閑線程數
ThreadsPerChild 25 #每個進程可以啟動的線程數量
MaxRequestWorkers 150 #線程數量最大值
MaxConnectionsPerChild 0 #最大串連數限制
ThreadLimit 64 #每個進程可以啟動的線程數量上限值
</IfModule>
**

**目錄屬性
vim /etc/httpd.conf

<Directory "/usr/local/httpd/htdocs">
Options Indexes FollowSymLinks

AllowOverride None<RequireAll>     Require all granted      //允許所有     Require not ip 192.168.176.140   //不讓176.140訪問</RequireAll>

</Directory>**

Apache最佳化深入

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.