服务器优化——Sysctl、Apache、MySQL

2009-05-13 04:34:15来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折



TAG:
System(FreeBSD)
来自:互联网
  服务器的负载能力,很大程度上取决于系统管理员的配置和优化能力。相同的硬件、不同的软件配置,会造成截然不同的效果。下面我将给大家介绍一下如何优化 sysctrl, Apache 以及 MySQL 。请注意,所有配置均为取决于个人,请根据自己的实际情况做调整。
  
  配置Sysctl
  
  编辑此文件:
  
  nano -w /etc/sysctl.conf
  
  如果该文件为空,则输入以下内容,否则请根据情况自己做调整:
  
  # Controls source route verification
  # Default should work for all interfaces
  net.ipv4.conf.default.rp_filter = 1
  # net.ipv4.conf.all.rp_filter = 1
  # net.ipv4.conf.lo.rp_filter = 1
  # net.ipv4.conf.eth0.rp_filter = 1
  
  # Disables IP source routing
  # Default should work for all interfaces
  net.ipv4.conf.default.accept_source_route = 0
  # net.ipv4.conf.all.accept_source_route = 0
  # net.ipv4.conf.lo.accept_source_route = 0
  # net.ipv4.conf.eth0.accept_source_route = 0
  
  # Controls the System Request debugging functionality of the kernel
  kernel.sysrq = 0
  
  # Controls whether core dumps will append the PID to the core filename.
  # Useful for debugging multi-threaded applications.
  kernel.core_uses_pid = 1
  
  # Increase maximum amount of memory allocated to shm
  # Only uncomment if needed!
  # kernel.shmmax = 67108864
  
  # Disable ICMP Redirect Acceptance
  # Default should work for all interfaces
  net.ipv4.conf.default.accept_redirects = 0
  # net.ipv4.conf.all.accept_redirects = 0
  # net.ipv4.conf.lo.accept_redirects = 0
  # net.ipv4.conf.eth0.accept_redirects = 0
  
  # Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
  # Default should work for all interfaces
  net.ipv4.conf.default.log_martians = 1
  # net.ipv4.conf.all.log_martians = 1
  # net.ipv4.conf.lo.log_martians = 1
  # net.ipv4.conf.eth0.log_martians = 1
  
  # Decrease the time default value for tcp_fin_timeout connection
  net.ipv4.tcp_fin_timeout = 25
  
  # Decrease the time default value for tcp_keepalive_time connection
  net.ipv4.tcp_keepalive_time = 1200
  
  # Turn on the tcp_window_scaling
  net.ipv4.tcp_window_scaling = 1
  
  # Turn on the tcp_sack
  net.ipv4.tcp_sack = 1
  
  # tcp_fack should be on because of sack
  net.ipv4.tcp_fack = 1
  
  # Turn on the tcp_timestamps
  net.ipv4.tcp_timestamps = 1
  
  # Enable TCP SYN Cookie Protection
  net.ipv4.tcp_syncookies = 1
  
  # Enable ignoring broadcasts request

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:用SSL构建一个安全的Apache

下一篇:目前使用的一些命令,记录一下,以免忘记