×ðÁú¿­Ê±

Nginx¿ªÆôHTTP/2ÉèÖ㬼ÓËÙÍøÕ¾»á¼û

nginx¿ªÆôhttp/2ÉèÖ㬼ÓËÙÍøÕ¾»á¼û

Ëæ×Å»¥ÁªÍøµÄѸËÙÉú³¤£¬ÍøÕ¾»á¼ûËÙÂʶÔÓû§ÌåÑéµÄÖ÷ÒªÐÔÔ½À´Ô½¸ß¡£ÎªÁËÌáÉýÍøÕ¾µÄÐÔÄܺͼÓËÙ»á¼ûËÙÂÊ£¬Ðí¶àÍøÕ¾¶¼½ÓÄÉÁËHTTP/2ЭÒé¡£¶øNginx×÷Ϊһ¸ö¸ßÐÔÄܵÄWebЧÀÍÆ÷£¬Ò²Ö§³ÖHTTP/2ЭÒ飬²¢ÇÒÉèÖÃÆðÀ´ºÜÊÇÀû±ã¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃnginx¿ªÆôhttp/2ÉèÖ㬼ÓËÙÍøÕ¾»á¼û¡£

Ò»¡¢ÏµÍ³×¼±¸

Ê×ÏÈ£¬È·±£ÄãÒѾ­×°ÖÃÁËNginx²¢ÇÒ°æ±¾ºÅÔÚ1.9.5¼°ÒÔÉÏ¡£ÈôÊÇÄãµÄNginx°æ±¾½ÏµÍ£¬ÐèÒªÉý¼¶µ½×îа汾¡£ÁíÍ⣬ÄãÒ²ÐèÒªÒ»¸öÓòÃû£¬²¢ÉèÖúý«¸ÃÓòÃûÖ¸ÏòÄãµÄЧÀÍÆ÷IP¡£

¶þ¡¢ÌìÉúSSLÖ¤Êé

HTTP/2ЭÒéÒªÇóʹÓüÓÃÜÅþÁ¬£¬ÒÔÊÇÎÒÃÇÐèҪΪÍøÕ¾ÌìÉúÒ»¸öSSLÖ¤Êé¡£ÏÂÃæÊÇÒ»¸öʹÓÃLet’s EncryptÃâ·ÑSSLÖ¤ÊéµÄÀý×Ó£º

×°ÖÃcertbot¹¤¾ß

$ wget https://dl.eff.org/certbot-auto
$ chmod +x certbot-auto

µÇ¼ºó¸´ÖÆ

ÌìÉúÖ¤Êé

$ ./certbot-auto certonly --webroot -w /var/www/html -d yourdomain.com

µÇ¼ºó¸´ÖÆ

ÕâÀïÐèÒª½«yourdomain.comÌ滻ΪÄãµÄÓòÃû¡£

Ö¤ÊéÌìÉúÀֳɺó£¬Äã¿ÉÒÔÔÚ/etc/letsencrypt/live/yourdomain.com/Ŀ¼ÏÂÕÒµ½Ö¤ÊéÎļþ¡£

Èý¡¢ÉèÖÃNginx¿ªÆôHTTP/2

·­¿ªNginxÉèÖÃÎļþ

$ nano /etc/nginx/nginx.conf

µÇ¼ºó¸´ÖÆ

ÕÒµ½ÒÔÏ´úÂ룬½«listenºÍssl_certificateÉèÖÃÏîƾ֤ÏÖÕæÏàÐÎÐ޸ģ¬²¢Ìí¼Óssl_protocolsºÍssl_ciphersÉèÖÃÏ

server {
    listen 443 ssl http2;
    server_name yourdomain.com;
    root /path/to/your/website;
    index index.html;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    ssl_protocols TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES25';

    location / {
        try_files $uri $uri/ =404;
    }
}

µÇ¼ºó¸´ÖÆ

ÕâÀïÐèÒª½«yourdomain.comÌ滻ΪÄãµÄÓòÃû£¬²¢½«/path/to/your/websiteÌ滻ΪÄãÍøÕ¾µÄÏÖʵ·¾¶¡£

ÉúÑIJ¢Í˳öÉèÖÃÎļþ¡£

ËÄ¡¢ÖØÆôNginx

Íê³ÉÒÔÉÏÉèÖúó£¬ÖØÆôNginxʹÆäÉúЧ£º

$ systemctl restart nginx

µÇ¼ºó¸´ÖÆ

Îå¡¢²âÊÔHTTP/2

ΪÁËÈ·±£HTTP/2ÒѾ­ÀÖ³ÉÆôÓ㬿ÉÒÔͨ¹ý»á¼ûHTTPSµÄÍøÖ·À´²âÊÔ¡£

ÔÚä¯ÀÀÆ÷ÖÐÊäÈëhttps://yourdomain.com£¬ÔÚ·­¿ªµÄÍøÒ³Öеã»÷ÓÒ¼üÑ¡Ôñ¡°¼ì²é¡±£¨»òÕß°´F12·­¿ª¿ØÖÆ̨£©£¬Ñ¡Ôñ¡°Network¡±Ñ¡Ï£¬È»ºóË¢ÐÂÒ³Ãæ¡£ÔÚProtocolÁÐÖÐÓ¦¸ÃÏÔʾΪh2£¬ÌåÏÖ¸ÃÒ³ÃæÕýÔÚͨ¹ýHTTP/2ЭÒé¼ÓÔØ¡£

Áù¡¢×ܽá

ͨ¹ýÒÔÉϼòÆӵİ취£¬ÎÒÃǾÍÀֳɵØÉèÖÃÁËNginx¿ªÆôHTTP/2£¬¼ÓËÙÁËÍøÕ¾µÄ»á¼ûËÙÂÊ¡£HTTP/2ЭÒéͨ¹ý¶à·¸´ÓÃÊÖÒÕºÍÍ·²¿Ñ¹ËõµÈ»úÖÆ£¬ÓÐÓÃÌáÉýÁËÍøÒ³µÄ¼ÓÔØËÙÂÊ£¬ÌṩÁ˸üºÃµÄÓû§ÌåÑé¡£ÈôÊÇÄãµÄÍøÕ¾»¹Ã»ÓпªÆôHTTP/2£¬ÎÞ·ÁʵÑéÒÔÉÏÉèÖÃÒªÁ죬ΪÓû§Ìṩ¸ü¿ìËٵĻá¼ûÌåÑé¡£

ÒÔÉϾÍÊÇNginx¿ªÆôHTTP/2ÉèÖ㬼ÓËÙÍøÕ¾»á¼ûµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

13452372176

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

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

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