HTTP/2 sigar ingantaccen tsarin HTTP ne wanda ke ba da fa'idodin ayyuka masu mahimmanci idan aka kwatanta da HTTP/1.1. A cikin wannan labarin, za mu koyi game da fa'idodin HTTP/2 da yadda ake haɗa shi cikin Laravel aikace-aikace.
Fa'idodin Amfani da HTTP/2
Multiplexing
HTTP/2 yana ba da damar aika buƙatun da yawa da karɓar amsoshi da yawa a lokaci guda akan haɗin gwiwa ɗaya. Wannan yana rage toshe kan layi kuma yana haɓaka aikin ɗaukar hoto.
Tura Sabar
HTTP/2 yana goyan bayan Push uwar garken, yana bawa uwar garken damar tura albarkatu masu mahimmanci ga mai binciken kafin a nema. Wannan yana rage lokacin jira don albarkatu kuma yana haɓaka nauyin shafi.
Matsi na kai
HTTP / 2 yana amfani da matsawa na HPACK don rage girman buƙatun da masu amsa amsa, adana bandwidth da haɓaka aiki.
Daidaita Baya tare da HTTP/1.1
HTTP/2 yana dacewa da baya tare da HTTP/1.1. Wannan yana nufin cewa masu bincike da sabar da ba sa goyan bayan HTTP/2 na iya aiki da sigar HTTP ta baya.
Haɗa HTTP/2 cikin Laravel
Don amfani da HTTP/2 a cikin Laravel aikace-aikacen, kuna buƙatar shigarwa da daidaita sabar yanar gizo mai goyan bayan HTTP/2, kamar Apache ko Nginx.
Don saita sabar gidan yanar gizo don tallafawa HTTP/2, bi waɗannan matakan:
Shigar da Takaddun shaida na SSL/TLS
HTTP/2 yana buƙatar kafaffen haɗi ta SSL/TLS. Don haka, kuna buƙatar shigar da takardar shaidar SSL/TLS don sabar gidan yanar gizon ku. Kuna iya amfani da Let's Encrypt don samun takardar shaidar SSL kyauta.
Sabunta Sigar Sabar Yanar Gizo
Tabbatar cewa kuna amfani da sabon sigar sabar gidan yanar gizo na Apache ko Nginx, kamar yadda HTTP/2 ke samun goyan bayan a cikin sabbin fitowar.
Kunna HTTP/2
Sanya sabar gidan yanar gizo don kunna HTTP/2 don shafukan da aka aika daga Laravel. Don Apache, zaku iya amfani da mod_http2 module, yayin da don Nginx, kuna buƙatar saita nghttpx.
Da zarar kun saita sabar gidan yanar gizo don tallafawa HTTP/2, Laravel aikace-aikacenku zai yi amfani da wannan ka'ida lokacin loda albarkatu da hulɗa tare da sabar. Wannan yana haɓaka aiki kuma yana haɓaka ƙwarewar mai amfani akan masu binciken da ke goyan bayan HTTP/2.