Web server Optimization Tutorial in CentOS system

Source: Internet
Author: User
Tags centos

① Modify the maximum number of files that can be opened by the server open files, because the Linux socket is also file, so this parameter has a direct impact on the number of network connections, the general machine is 1024, can be set to 65536
#vi/etc/security/limits.conf
The last two lines add the following
* Soft Nofile 65536
* Hard Nofile 65536

② Close the IPv6, so far we do not need to IPv6, the system after the installation is self-contained and open, we need to close.
See if there are any IPv6
#ifconfig #如果出现inet6 Addr ... The words, the description is installed
Or
#lsmod | grep IPv6 #会显示内核加载的ipv6相关模块
Disable www.111cn.net with the following command
#vi/etc/sysconfig/network
Modify
Networking_ipv6=yes
For
Networking_ipv6=no
And then close its module
#vi/etc/modprobe.d/dist.conf
Add the following two lines at the end of the file
Alias net-pf-10 off
Alias IPv6 off
Disable iptables for IPv6
#chkconfig Ip6tables off
Restart the machine to take effect after the modification is complete

③ TCP/IP network parameters tuning
#vi/etc/sysctl.conf
Add or modify the following configuration
net.ipv4.tcp_syncookies = 1 #表示开启SYN cookies, enabling cookies to be processed when SYN waits for queues overflow to prevent small SYN attacks
Net.ipv4.tcp_tw_reuse = 1 #表示开启重用. Allow time-wait sockets to be reconnected to a new TCP connection by default of 0, which means shutdown
net.ipv4.tcp_tw_recycle = 1 #表示开启TCP连接中TIME-wait sockets quick Recycle, default to 0, indicates shutdown
Net.ipv4.tcp_fin_timeout = #修改系? Default timeout time, in seconds, default to 240 seconds

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.