×ðÁú¿­Ê±¹ÙÍøµÇ¼

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

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

ͻ񻣼

Ëæ×Å»¥ÁªÍøµÄѸÃÍÉú³¤£¬ÍøÕ¾µÄ»á¼ûËÙÂʳÉΪÓû§ÌåÑéµÄÖ÷ÒªÒòËØÖ®Ò»¡£HTTP/2ÊÇÒ»ÖÖеÄÍøÂçЭÒ飬¿ÉÒÔÓÐÓõØÌá¸ßÍøÕ¾µÄ¼ÓÔØËÙÂʺÍÐÔÄÜ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚNginxÉÏ¿ªÆôHTTP/2ÉèÖ㬴Ӷø¼ÓËÙÍøÕ¾µÄ»á¼ûËÙÂÊ¡£

×°ÖÃNginx

Ê×ÏÈ£¬ÐèҪȷ±£ÒѾ­×°ÖÃÁËNginx¡£ÔÚUbuntuϵͳÉÏ£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´×°ÖÃNginx£º

$ sudo apt-get update
$ sudo apt-get install nginx

µÇ¼ºó¸´ÖÆ

ÔÚ×°ÖÃÍê³Éºó£¬Í¨¹ýÒÔÏÂÏÂÁîÀ´ÑéÖ¤NginxÊÇ·ñÒѾ­ÀÖ³É×°Öãº

$ nginx -v

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

¼ì²éNginxÊÇ·ñÖ§³ÖHTTP/2

ÔÚÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁ

$ nginx -v

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

ÔÚÊä³öÐÅÏ¢ÖУ¬¿ÉÒÔÉó²éÊÇ·ñ°üÀ¨ÁË–with-http_v2_module£¬ÈôÊDZ£´æÔòÌåÏÖNginxÒѾ­Ö§³ÖHTTP/2£¬²»È»ÐèÒªÖØбàÒëNginx»òÕß×°ÖÃÖ§³ÖHTTP/2µÄ°æ±¾¡£

ÐÞ¸ÄNginxÉèÖÃÎļþ

ÔÚ½«ÉèÖÃÎļþÐÞ¸ÄÇ°£¬¿ÉÒÔÏȱ¸·ÝÄ¿½ñµÄÉèÖÃÎļþ¡£ÉèÖÃÎļþͨ³£Î»ÓÚ/etc/nginx/nginx.conf»òÕß/etc/nginx/conf.d/default.conf¡£

·­¿ªÉèÖÃÎļþ£¬²¢ÕÒµ½server²¿·Ö£¬Ìí¼ÓÒÔÏÂÉèÖãº

listen 443 ssl http2;
ssl_certificate /path/to/your/certificate.pem;
ssl_certificate_key /path/to/your/private_key.pem;

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬/path/to/your/certificate.pemºÍ/path/to/your/private_key.pemÐèÒªÌæ»»³ÉÄãµÄSSLÖ¤ÊéºÍ˽ԿµÄ·¾¶¡£

ÖØмÓÔØNginxÉèÖÃ

ÉúÑÄÉèÖÃÎļþºó£¬Ö´ÐÐÒÔÏÂÏÂÁîÀ´ÖØмÓÔØNginxÉèÖãº

$ sudo service nginx restart

µÇ¼ºó¸´ÖÆ

ÈôÊÇÉèÖÃÎļþÖÐûÓйýʧ£¬Nginx½«»áÖØмÓÔØÉèÖò¢ÆôÓÃHTTP/2¡£

Ä¥Á·HTTP/2ÊÇ·ñÉúЧ

¿ÉÒÔʹÓÃÒÔÏÂÍøÕ¾»ò¹¤¾ßÀ´ÑéÖ¤ÊÇ·ñÀֳɿªÆôÁËHTTP/2£º

https://tools.keycdn.com/http2-test

https://www.ssllabs.com/ssltest/

ÔÚÑé֤Ч¹ûÖУ¬¿ÉÒÔÉó²éµ½HTTP/2ÊÇ·ñÀֳɿªÆô¡£

×ܽ᣺

±¾ÎÄÏÈÈÝÁËÔÚNginxÉÏ¿ªÆôHTTP/2ÉèÖõİ취£¬²¢¸½ÉÏÁËÏà¹ØµÄ´úÂëʾÀý¡£HTTP/2×÷ΪһÖÖеÄÍøÂçЭÒ飬¿ÉÒÔÓÐÓõØÌá¸ßÍøÕ¾µÄ¼ÓÔØËÙÂʺÍÐÔÄÜ¡£Í¨¹ýÉèÖÃNginx£¬¿ÉÒÔÈÃÍøÕ¾¸ü¿ìµØ¼ÓÔز¢ÌáÉýÓû§ÌåÑ顣ϣÍû±¾ÎÄÄܶÔÄãÔÚNginxÉÏ¿ªÆôHTTP/2ÉèÖÃÓÐËù×ÊÖú¡£

²Î¿¼ÎÄÏ×£º

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-with-http-2-support-on-ubuntu-16-04

https://www.nginx.com/blog/nginx-1-9-5/

https://www.nginx.com/blog/http2-module-nginx/

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ