尊龙凯时人生就是博

CentOS 7Ï´webЧÀÍÆ÷µÄÍøÂçÇå¾²¼Ó¹Ì¼¼ÇÉ

centos 7 Ï´ web ЧÀÍÆ÷µÄÍøÂçÇå¾²¼Ó¹Ì¼¼ÇÉ

web ЧÀÍÆ÷ÊÇÏÖ´ú»¥ÁªÍøµÄÖ÷Òª×é³É²¿·Ö£¬Òò´Ë±£»¤ web ЧÀÍÆ÷µÄÇå¾²ÐÔºÜÊÇÖ÷Òª¡£Í¨¹ý¼Ó¹ÌÍøÂçÇå¾²£¬¿ÉÒÔïÔ̭Σº¦ºÍ×èֹDZÔڵĹ¥»÷¡£±¾ÎĽ«ÏÈÈÝÔÚ CentOS 7 Éϴ web ЧÀÍÆ÷ʱ³£ÓõÄÍøÂçÇå¾²¼Ó¹Ì¼¼ÇÉ£¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£

¸üÐÂϵͳºÍÈí¼þ

Ê×ÏÈ£¬È·±£ÄãµÄϵͳºÍÈí¼þÊÇ×îа汾¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¸üРCentOS 7 ÉϵÄÈí¼þ°ü£º

sudo yum update

µÇ¼ºó¸´ÖÆ

¹Ø±Õ²»ÐëÒªµÄЧÀÍ

ΪÁËÌá¸ßϵͳµÄÇå¾²ÐÔ£¬Ó¦¸Ã¹Ø±ÕһЩ²»ÐëÒªµÄЧÀÍ¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Éó²éÄ¿½ñÒÑ×°ÖõÄЧÀÍ£º

sudo systemctl list-unit-files --type=service | grep enabled

µÇ¼ºó¸´ÖÆ

ƾ֤ÐèÒª£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî×èÖ¹ºÍ½ûÓÃÏìÓ¦µÄЧÀÍ¡£ÀýÈ磬ÈôÊDz»ÐèҪʹÓà FTP ЧÀÍÆ÷£¬¿ÉÒÔ×èÖ¹²¢½ûÓà vsftpd£º

sudo systemctl stop vsftpd
sudo systemctl disable vsftpd

µÇ¼ºó¸´ÖÆ

ÉèÖ÷À»ðǽ

ÉèÖ÷À»ðǽÊDZ£»¤ web ЧÀÍÆ÷µÄÖ÷Òª²½·¥Ö®Ò»¡£ÔÚ CentOS 7 ÉÏ£¬¿ÉÒÔʹÓà firewalld À´ÖÎÀí·À»ðǽ¡£ÒÔÏÂÊÇһЩ³£ÓõķÀ»ðǽ¹æÔò£º

ÔÊÐí HTTP ºÍ HTTPS Á÷Á¿½øÈëЧÀÍÆ÷£º

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

µÇ¼ºó¸´ÖÆ

ÔÊÐí SSH ÅþÁ¬½øÈëЧÀÍÆ÷£º

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload

µÇ¼ºó¸´ÖÆ

ÏÞÖÆÈëÕ¾ÅþÁ¬ÊýÄ¿£º

sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="0.0.0.0/0" limit value="5/m" accept'
sudo firewall-cmd --reload

µÇ¼ºó¸´ÖÆ

ʹÓà HTTPS ¼ÓÃÜͨѶ

HTTPS ÊÇÒ»ÖÖͨ¹ýʹÓà SSL »ò TLS ¼ÓÃÜ»úÖÆÀ´±£»¤ web ЧÀÍÆ÷ºÍ¿Í»§¶ËÖ®¼äͨѶµÄÇ徲ЭÒé¡£¿ÉÒÔʹÓà Certbot ¹¤¾ß×Ô¶¯ÎªÄãµÄÍøÕ¾ÌìÉúºÍÉèÖà SSL Ö¤Êé¡£ÒÔÏÂÊÇÔÚ CentOS 7 ÉÏ×°ÖúÍÉèÖà Certbot µÄʾÀýÏÂÁ

Ê×ÏÈ£¬×°Öà Certbot ºÍ Certbot Nginx ²å¼þ£º

sudo yum install certbot python2-certbot-nginx

µÇ¼ºó¸´ÖÆ

È»ºó£¬ÎªÄãµÄÍøÕ¾ÆôÓà SSL£º

sudo certbot --nginx

µÇ¼ºó¸´ÖÆ

×°ÖúÍÉèÖà Web Ó¦Ó÷À»ðǽ

Web Ó¦Ó÷À»ðǽ (WAF) ¿ÉÒÔ¼ì²âºÍ×èÖ¹Õë¶Ô web Ó¦ÓõĹ¥»÷¡£ÔÚ CentOS 7 ÉÏ£¬ModSecurity ÊÇÒ»¸ö³£ÓÃµÄ WAF ¹¤¾ß¡£ÒÔÏÂÊÇÔÚ CentOS 7 ÉÏ×°ÖúÍÉèÖà ModSecurity µÄʾÀýÏÂÁ

Ê×ÏÈ£¬×°Öà ModSecurity ºÍ Nginx Ä£¿é£º

sudo yum install mod_security mod_security_crs nginx-mod-http-modsecurity

µÇ¼ºó¸´ÖÆ

È»ºó£¬ÆôÓà ModSecurity£º

sudo sed -i 's/SecRuleEngine DetectionOnly/SecRuleEngine On/' /etc/httpd/conf.d/mod_security.conf

µÇ¼ºó¸´ÖÆ

×îºó£¬ÖØÐÂÆô¶¯ Nginx£º

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÉèÖõǼ±£»¤

ΪÁ˱£»¤ web ЧÀÍÆ÷µÄµÇ¼ҳÃ棬¿ÉÒÔÏÞÖÆ»á¼ûµÇ¼ҳÃæµÄ IP µØµã¡£ÒÔÏÂÊÇʹÓà Nginx ÉèÖõǼ±£»¤µÄʾÀý´úÂ룺

±à¼­ Nginx ÉèÖÃÎļþ£º

sudo nano /etc/nginx/nginx.conf

µÇ¼ºó¸´ÖÆ

ÔÚ “http” ¿éÖÐÌí¼ÓÒÔÏ´úÂ룺

map $remote_addr $limited_access {
    192.168.1.1     '';
    10.0.0.0/24     '';
    default         1;
}

server {
    ...
    location /login {
        deny all;
        allow $limited_access;
        auth_basic "Restricted Access";
        auth_basic_user_file /etc/nginx/.htpasswd;
    }
}

µÇ¼ºó¸´ÖÆ

ÉúÑIJ¢Í˳öÉèÖÃÎļþ¡£È»ºó½¨ÉèÓÃÓÚÑéÖ¤µÇ¼µÄÓû§ÃûºÍÃÜÂ룺

sudo htpasswd -c /etc/nginx/.htpasswd username

µÇ¼ºó¸´ÖÆ

×îºó£¬ÖØÐÂÆô¶¯ Nginx£º

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

±¾ÎÄÏÈÈÝÁËÔÚ CentOS 7 Ï´ web ЧÀÍÆ÷ʱ³£ÓõÄÍøÂçÇå¾²¼Ó¹Ì¼¼ÇÉ¡£Í¨¹ý¸üÐÂϵͳºÍÈí¼þ¡¢¹Ø±Õ²»ÐëÒªµÄЧÀÍ¡¢ÉèÖ÷À»ðǽ¡¢Ê¹Óà HTTPS ¼ÓÃÜͨѶ¡¢×°ÖúÍÉèÖà Web Ó¦Ó÷À»ðǽÒÔ¼°ÉèÖõǼ±£»¤£¬¿ÉÒÔÌá¸ß web ЧÀÍÆ÷µÄÍøÂçÇå¾²ÐÔ¡£Ï£ÍûÒÔÉϼ¼ÇɶÔÄãÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇCentOS 7Ï´webЧÀÍÆ÷µÄÍøÂçÇå¾²¼Ó¹Ì¼¼ÇɵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ