centos7作為web伺服器最佳化

來源:互聯網
上載者:User

標籤:cookies   live   ipv4   time   swa   web服務   dex   ted   proc   

centos7作為web伺服器最佳化

原文 http://itindex.net/detail/51140-centos7-web-伺服器


1、加大開啟檔案數的限制(open files)

查看

ulimit -n
ulimit -a

vi /etc/security/limits.conf
最後添加

* soft nofile 1024000

* hard nofile 1024000

hadoop - nofile 1024000

hadoop - nproc 1024000

使用者進程限制

vi /etc/security/limits.d/20-nproc.conf

#加大普通使用者限制 也可以改為unlimited
* soft nproc 40960
root soft nproc unlimited
此步驟需要重啟機器生效,可以設定完後再重啟

2、網路線程最佳化

vi /etc/sysctl.conf
加入下面幾行

# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

# Determines how often to check for stale neighbor entries.
net.ipv4.neigh.default.gc_stale_time=120

# Using arp_announce/arp_ignore to solve the ARP Problem
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.all.arp_announce=2
vm.swappiness = 0
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
net.ipv4.conf.lo.arp_announce=2


net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 15

net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30


執行下面命令生效
/sbin/sysctl -p

centos7作為web伺服器最佳化

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.