LinuxЧÀÍÆ÷Çå¾²ÐÔÓëÐÔÄÜÓÅ»¯£ºÒ»¼ýË«ùm
LinuxЧÀÍÆ÷Çå¾²ÐÔÓëÐÔÄÜÓÅ»¯£ºÒ»¼ýË«ùm
ÔÚµ±½ñ»¥ÁªÍøµÄʱ´ú£¬LinuxЧÀÍÆ÷³ÉΪÁË´ó´ó¶¼ÆóÒµºÍСÎÒ˽¼ÒÊ×Ñ¡µÄЧÀÍÆ÷²Ù×÷ϵͳ¡£¶øÔõÑùÌá¸ßLinuxЧÀÍÆ÷µÄÇå¾²ÐÔºÍÐÔÄÜÓÅ»¯³ÉΪÁËÿ¸öÖÎÀíÔ±ºÍÔËάְԱ¶¼¹Ø×¢µÄÖ÷ÒªÎÊÌâ¡£
±¾ÎĽ«ÏÈÈÝһЩ³£ÓõÄLinuxЧÀÍÆ÷µÄÇå¾²ÐÔºÍÐÔÄÜÓÅ»¯µÄÒªÁìºÍ¼¼ÇÉ£¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£
Ò»¡¢Çå¾²ÐÔÓÅ»¯
եȡrootÔ¶³ÌµÇ¼
ΪÁ˱ÜÃâÔ¶³ÌºÚ¿Í¹¥»÷£¬Ó¦Õ¥È¡rootÕË»§µÄÔ¶³ÌµÇ¼¡£¿ÉÒÔͨ¹ý±à¼SSHÉèÖÃÎļþ/etc/ssh/sshd_config£¬½«”PermitRootLogin”ÉèÖÃΪ”no”À´ÊµÏÖ£º
PermitRootLogin no
ÆôÓ÷À»ðǽ
ʹÓ÷À»ðǽ¿ÉÒÔÏÞÖƶÔЧÀÍÆ÷µÄ»á¼ûºÍÁ÷Á¿¿ØÖÆ£¬ÔöÌíЧÀÍÆ÷µÄÇå¾²ÐÔ¡£³£ÓõķÀ»ðǽ¹¤¾ßÓÐiptablesºÍfirewalld¡£ÏÂÃæÊÇÒ»¸öiptablesµÄʾÀý¹æÔò£¬Ö»ÔÊÐíÀ´×ÔÖ¸¶¨IPµØµãµÄSSHÅþÁ¬£º
iptables -A INPUT -p tcp -s 192.168.1.100 –dport 22 -j ACCEPT
iptables -A INPUT -p tcp –dport 22 -j DROP
°´ÆÚ¸üÐÂϵͳºÍÈí¼þ
°´ÆÚ¸üÐÂЧÀÍÆ÷µÄϵͳºÍÈí¼þÊǼá³ÖЧÀÍÆ÷Çå¾²µÄÖ÷Òª²½·¥¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¸üÐÂϵͳºÍÈí¼þ°ü£º
apt-get update
apt-get upgrade
¶þ¡¢ÐÔÄÜÓÅ»¯
ºÏÀí·ÖÅÉÓ²¼þ×ÊÔ´
ÔÚЧÀÍÆ÷µÄÓ²¼þ×ÊÔ´·ÖÅÉÖУ¬Ó¦Æ¾Ö¤Ó¦ÓóÌÐòµÄÐèÇóºÍ¸ºÔØÇéÐκÏÀí·ÖÅÉCPU¡¢ÄÚ´æºÍ´ÅÅÌ¿Õ¼äµÈ×ÊÔ´£¬ÒÔÌá¸ßЧÀÍÆ÷µÄÐÔÄÜ¡£¿ÉÒÔʹÓù¤¾ßÈçtop¡¢htopºÍvmstatÀ´¼à¿ØЧÀÍÆ÷µÄ×ÊԴʹÓÃÇéÐΡ£
ÓÅ»¯ÏµÍ³²ÎÊýÉèÖÃ
ÓÅ»¯LinuxЧÀÍÆ÷µÄϵͳ²ÎÊýÉèÖÿÉÒÔÏÔÖøÌá¸ßЧÀÍÆ÷µÄÐÔÄÜ¡£ÒÔÏÂÊÇһЩ³£ÓõIJÎÊýµ÷½âʾÀý£º
½ûÓÃÎ޹صÄЧÀÍ£º
service bluetooth stop
service cups stop
chkconfig bluetooth off
chkconfig cups off
µ÷½âÎļþ·¿ªÊýÏÞÖÆ£º
echo ‘fs.file-max = 65535’ >> /etc/sysctl.conf
sysctl -p
ÓÅ»¯TCPÅþÁ¬²ÎÊý£º
echo ‘net.ipv4.tcp_fin_timeout = 30’ >> /etc/sysctl.conf
echo ‘net.ipv4.tcp_tw_reuse = 1’ >> /etc/sysctl.conf
sysctl -p
ʹÓûº´æºÍ¼ÓËÙÊÖÒÕ
ʹÓûº´æºÍ¼ÓËÙÊÖÒÕ¿ÉÒÔ´ó´óÌá¸ßЧÀÍÆ÷µÄÐÔÄÜ¡£ÒÔÏÂÊÇһЩ³£¼ûµÄÊÖÒպʹúÂëʾÀý£º
ʹÓÃNginx×÷Ϊ·´ÏòÊðÀíЧÀÍÆ÷£º
location / {
proxy_pass http://backend;
µÇ¼ºó¸´ÖÆ
}
ʹÓÃMemcached×÷Ϊ»º´æЧÀÍÆ÷£º
$mc = new Memcached();
$mc->addServer(‘localhost’, 11211);
$value = $mc->get(‘key’);
ʹÓÃRedis×÷Ϊ»º´æЧÀÍÆ÷£º
$redis = new Redis();
$redis->connect(‘127.0.0.1’, 6379);
$value = $redis->get(‘key’);
×ܽ᣺
ͨ¹ý¶ÔLinuxЧÀÍÆ÷¾ÙÐÐÇå¾²ÐÔºÍÐÔÄÜÓÅ»¯£¬¿ÉÒÔͬʱÌá¸ßЧÀÍÆ÷µÄÎȹÌÐÔºÍÏìÓ¦ËÙÂÊ£¬ïÔÌDZÔÚµÄÇ徲Σº¦¡£ÖÎÀíÔ±ºÍÔËάְԱӦ¸Ãƾ֤ÏÖʵÐèÇóºÍÏêϸÇéÐΣ¬ÎÞаÔËÓÃÏà¹ØÒªÁìºÍÊÖÒÕ£¬ÊµÏÖÇå¾²ÐÔÓëÐÔÄÜÓÅ»¯µÄË«Ó®¡£Í¬Ê±£¬ÎÒÃÇҲҪʱ¿Ì¹ØעеÄÊÖÒÕºÍÎó²î£¬¼á³Ö¶ÔLinuxЧÀÍÆ÷Çå¾²ÐÔºÍÐÔÄÜÓÅ»¯µÄÒ»Á¬Ñ§Ï°ºÍˢС£
ÒÔÉϾÍÊÇLinuxЧÀÍÆ÷Çå¾²ÐÔÓëÐÔÄÜÓÅ»¯£ºÒ»¼ýË«ùmµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡