Putting it all together 將所有內容整合在一起

官方鏈接

https://www.youtube.com/watch?v=Aa_FAA3v22g&t=1s

Task1 Putting It All Together 將所有內容整合在一起

圖片版

文字版

Putting It All Together
將所有內容整合在一起

From the previous modules, you'll have learned that quite a lot of things go on behind the scenes when you request a webpage in your browser.

從前面的模塊中,你應該已經了解到,當你在瀏覽器中請求網頁時,背后會發生很多事情。

To summarise, when you request a website, your computer needs to know the server's IP address it needs to talk to; for this, it uses DNS. Your computer then talks to the web server using a special set of commands called the HTTP protocol; the webserver then returns HTML, JavaScript, CSS, Images, etc., which your browser then uses to correctly format and display the website to you.
總結一下,當你請求一個網站時,你的計算機需要知道它需要與之通信的服務器的 IP 地址;為此,它使用 DNS。然后,你的計算機使用一組特殊的命令 (稱為 HTTP 協議) 與 Web 服務器通信;Web 服務器隨后返回 HTML、JavaScript、CSS、圖像等,你的瀏覽器隨后使用這些命令正確地格式化并向你顯示網站。

There are also a few other components that help the web run more efficiently and provide extra features.


還有一些其他組件可以幫助 Web 更高效地運行,并提供額外的功能。

問題

答案

點擊一下就行

Task2 Other Components 其他組件

圖片版

文字版

Load Balancers負載均衡器

When a website's traffic starts getting quite large or is running an application that needs to have high availability, one web server might no longer do the job. Load balancers provide two main features, ensuring high traffic websites can handle the load and providing a failover if a server becomes unresponsive.
當網站的流量開始變得相當大或運行需要高可用性的應用程序時,單個 Web 服務器可能不再能完成這項工作。負載均衡器提供兩個主要功能,確保高流量網站能夠處理負載,并在服務器變得無響應時提供故障轉移。

When you request a website with a load balancer, the load balancer will receive your request first and then forward it to one of the multiple servers behind it. The load balancer uses different algorithms to help it decide which server is best to deal with the request. A couple of examples of these algorithms are round-robin, which sends it to each server in turn, or weighted, which checks how many requests a server is currently dealing with and sends it to the least busy server.
當你使用負載均衡器請求一個網站時,負載均衡器首先會收到你的請求,然后將其轉發給它背后的多個服務器之一。負載均衡器使用不同的算法來幫助它決定哪個服務器最適合處理請求。這些算法的一些例子是輪詢,它依次將請求發送給每個服務器;或者是加權,它檢查一個服務器當前正在處理的請求數量,并將其發送給最不忙的服務器。

Load balancers also perform periodic checks with each server to ensure they are running correctly; this is called a health check. If a server doesn't respond appropriately or doesn't respond, the load balancer will stop sending traffic until it responds appropriately again.
負載均衡器還會對每臺服務器進行定期檢查,以確保它們正常運行;這稱為運行狀況檢查。如果服務器沒有適當響應或沒有響應,負載均衡器將停止發送流量,直到它再次適當響應。


?

CDN (Content Delivery Networks)CDN (內容分發網絡)

A CDN can be an excellent resource for cutting down traffic to a busy website. It allows you to host static files from your website, such as JavaScript, CSS, Images, Videos, and host them across thousands of servers all over the world. When a user requests one of the hosted files, the CDN works out where the nearest server is physically located and sends the request there instead of potentially the other side of the world.

CDN 可以是減少繁忙網站流量的絕佳資源。它允許你托管網站的靜態文件,如 JavaScript、CSS、圖像、視頻,并將它們托管在全球數千臺服務器上。當用戶請求其中一個托管文件時,CDN 會計算出最近的服務器的物理位置,并將請求發送到那里,而不是潛在的世界另一端。

Databases
數據庫

Often websites will need a way of storing information for their users. Webservers can communicate with databases to store and recall data from them. Databases can range from just a simple plain text file up to complex clusters of multiple servers providing speed and resilience. You'll come across some common databases: MySQL, MSSQL, MongoDB, Postgres, and more; each has its specific features.
網站通常需要一種為用戶存儲信息的方式。Web 服務器可以與數據庫通信,以存儲和調用數據。數據庫可以從簡單的純文本文件到復雜的多個服務器集群,提供速度和彈性。你會遇到一些常見的數據庫:MySQL、MSSQL、MongoDB、Postgres 等,每個都有其獨特的特性。

WAF (Web Application Firewall)WAF (Web 應用層防火墻)

A WAF sits between your web request and the web server; its primary purpose is to protect the webserver from hacking or denial of service attacks. It analyses the web requests for common attack techniques, whether the request is from a real browser rather than a bot. It also checks if an excessive amount of web requests are being sent by utilising something called rate limiting, which will only allow a certain amount of requests from an IP per second. If a request is deemed a potential attack, it will be dropped and never sent to the webserver.
WAF 位于你的 Web 請求和 Web 服務器之間;它的主要目的是保護 Web 服務器免受黑客攻擊或拒絕服務攻擊。它分析 Web 請求以了解常見的攻擊技術,包括請求是否來自真實瀏覽器而非機器人。它還會檢查是否使用所謂的速率限制來發送過多的 Web 請求,這種限制每秒只允許來自一定數量的 IP 的請求。如果一個請求被認為是潛在的攻擊,它將被丟棄,并且永遠不會發送到 Web 服務器。

問題

答案

Task3 How Web Servers WorkWeb 服務器如何工作

圖片版

文字版

How Web servers work.Web 服務器是如何工作的。

What is a Web Server?
什么是 Web 服務器?

A web server is a software that listens for incoming connections and then utilises the HTTP protocol to deliver web content to its clients. The most common web server software you'll come across is Apache, Nginx, IIS and NodeJS. A Web server delivers files from what's called its root directory, which is defined in the software settings. For example, Nginx and Apache share the same default location of /var/www/html in Linux operating systems, and IIS uses C:\inetpub\wwwroot for the Windows operating systems. So, for example, if you requested the file http://www.example.com/picture.jpg, it would send the file /var/www/html/picture.jpg from its local hard drive.
Web 服務器是一種軟件,它會監聽傳入的連接,然后使用 HTTP 協議將 Web 內容傳遞給客戶端。你會遇到的最常見的 Web 服務器軟件是 Apache、Nginx、IIS 和 NodeJS。Web 服務器從其根目錄 (root directory) 傳遞文件,該目錄在軟件設置中定義。例如,Nginx 和 Apache 在 Linux 操作系統中共享相同的默認位置 /var/www/html, 而 IIS 在 Windows 操作系統中使用 C:inetpubwwwroot。因此,例如,如果你請求文件 http://www.example.com/picture.jpg, 它會從其本地硬盤驅動器發送文件 /var/www/html/picture.jpg。

Virtual Hosts虛擬主機

Web servers can host multiple websites with different domain names; to achieve this, they use virtual hosts. The web server software checks the hostname being requested from the HTTP headers and matches that against its virtual hosts (virtual hosts are just text-based configuration files). If it finds a match, the correct website will be provided. If no match is found, the default website will be provided instead.
Web 服務器可以托管具有不同域名的多個網站;為了實現這一點,它們使用虛擬主機。Web 服務器軟件會檢查 HTTP 首部請求的主機名,并將其與其虛擬主機進行匹配 (虛擬主機只是基于文本的配置文件)。如果找到匹配,就會提供正確的網站。如果沒有找到匹配,就會提供默認網站。

Virtual Hosts can have their root directory mapped to different locations on the hard drive. For example, one.com being mapped to /var/www/website_one, and two.com being mapped to /var/www/website_two
虛擬主機可以將其根目錄映射到硬盤驅動器上的不同位置。例如,one.com 映射到 /var/www/website_one,two.com 映射到 /var/www/web site_two。

There's no limit to the number of different websites you can host on a web server.
你可以在一個 Web 服務器上托管的不同網站數量沒有限制。

Static Vs Dynamic Content靜態內容與動態內容

Static content, as the name suggests, is content that never changes. Common examples of this are pictures, javascript, CSS, etc., but can also include HTML that never changes. Furthermore, these are files that are directly served from the webserver with no changes made to them.
靜態內容,顧名思義,是永遠不變的內容。常見的例子包括圖片、javascript、CSS 等,但也可以包括永遠不變的 HTML。此外,這些文件是直接從 Web 服務器提供的,不需要對其進行任何修改。

Dynamic content, on the other hand, is content that could change with different requests. Take, for example, a blog. On the homepage of the blog, it will show you the latest entries. If a new entry is created, the home page is then updated with the latest entry, or a second example might be a search page on a blog. Depending on what word you search, different results will be displayed.
另一方面,動態內容是指可能隨著不同請求而變化的內容。以一個博客為例。在博客的主頁上,它會顯示最新條目。如果創建了一個新條目,主頁就會更新為最新條目,或者第二個例子可能是博客的搜索頁面。根據你搜索的詞,將顯示不同的結果。

These changes to what you end up seeing are done in what is called the Backend with the use of programming and scripting languages. It's called the Backend because what is being done is all done behind the scenes. You can't view the websites' HTML source and see what's happening in the Backend, while the HTML is the result of the processing from the Backend. Everything you see in your browser is called the Frontend.
這些對你最終看到的內容的修改是在所謂的后端中使用編程和腳本語言完成的。它之所以被稱為后端,是因為所有正在進行的操作都是在幕后進行的。你無法查看網站的 HTML 源代碼,也無法看到后端中發生的事情,而 HTML 是后端處理的結果。你在瀏覽器中看到的所有內容都被稱為前端。

Scripting and Backend Languages腳本語言和后端語言

There's not much of a limit to what a backend language can achieve, and these are what make a website interactive to the user. Some examples of these languages (in no particular order :p) are
后端語言可以實現的功能并沒有太多限制,這些是使網站與用戶交互的因素。這些語言的一些例子 (不按特定順序:p) 如下:PHP, Python, Ruby, NodeJS, Perl and many more. These languages can interact with databases, call external services, process data from the user, and so much more. A very basic
、Python、Ruby、NodeJS、Perl 等。這些語言可以與數據庫交互、調用外部服務、處理用戶數據等。一個非常基本的PHP example of this would be if you requested the website
例如,如果你請求網站http://example.com/index.php?name=adamHttp://example.com/index.php?name=adam

If index.php was built like this:
如果 index.php 是這樣構建的:

<html><body>Hello <?php echo $_GET["name"]; ?></body></html>

It would output the following to the client:
它會向客戶端輸出以下內容:

<html><body>Hello adam</body></html>

You'll notice that the client doesn't see any PHP code because it's on the Backend. This interactivity opens up a lot more security issues for web applications that haven't been created securely, as you learn in further modules.
你會注意到,客戶端看不到任何 PHP 代碼,因為它位于后端。這種交互性為那些尚未安全創建的 Web 應用程序帶來了更多安全問題,你將在后續模塊中學習。

問題

答案

Task4 Quiz 小測驗

圖片版

文字版

The Quiz
小測驗

Click the "View Site" button on the right. Using everything you've learnt from the other modules, drag and drop the tiles into the correct order of how a request to a website works to reveal the flag.
點擊右側的 “查看網站” 按鈕。使用您從其他模塊中學到的所有知識,按照向網站發出請求以顯示標志的正確順序拖放磁貼。

Note: When placing a tile in the correct position, it will highlight in green. When a tile is in the wrong spot, it will highlight in red. Make sure not to refresh the page, as it will reset the tiles all to blank again!
注意:當將方塊放置在正確位置時,它將以綠色突出顯示。當方塊放置錯誤位置時,它將以紅色突出顯示。請確保不要刷新頁面,因為它會將所有方塊重置為空白!

問題

答案

理解

所以訪問網頁的大概流程是這樣的(用文字敘述)

1 在網頁上搜索網站

2 通過ip地址來檢查本地的緩存

3 檢查你的遞歸DNS服務器以獲取地址

4 查詢跟服務器以查找權威的DNS服務器

5 權威DNS服務器建議網站的ip地址

6 請求通過web應用程序防火墻

7 請求通過負載均衡器

8 連接到端口為80或443的web服務器

9 web服務器接收GET請求

10 web應用程序和數據庫通信

11 您的瀏覽器將HTML渲染為可查看到的網站

以下是訪問網頁的專業化流程描述

  1. 用戶發起請求
    用戶在瀏覽器地址欄輸入目標URL(統一資源定位符)并回車,或通過搜索引擎導航至目標網站。
  2. 本地DNS緩存查詢
    瀏覽器首先檢查本地DNS緩存(包括操作系統緩存及瀏覽器緩存),若存在有效域名解析記錄(域名→IP映射),則直接使用該IP地址,跳過后續DNS解析步驟。
  3. 遞歸DNS服務器查詢
    若本地無緩存,客戶端向配置的遞歸DNS服務器(Local DNS)發起查詢請求。遞歸DNS服務器檢查自身緩存,若有記錄則返回IP;若無則代表客戶端進行全球DNS層級查詢。
  4. 根域名與權威DNS服務器定位
    遞歸DNS服務器從根域名服務器開始迭代查詢,依次獲取頂級域(如.com)、二級域(如example.com)的權威DNS服務器地址,最終定位到目標域名的權威DNS服務器
  5. 權威DNS服務器響應解析記錄
    權威DNS服務器返回目標域名的解析記錄(A記錄或CNAME記錄),包含其托管服務器的IP地址。遞歸DNS服務器緩存該記錄并返回至客戶端。
  6. 請求經過安全防護層
    客戶端向目標IP發送的請求首先經過Web應用防火墻(WAF),進行安全策略檢測(如SQL注入/XSS攻擊防護),過濾惡意流量。
  7. 負載均衡器路由分發
    合法請求抵達負載均衡器(如LVS、Nginx)。負載均衡器依據預設算法(輪詢、最小連接數等)將請求分發至后端多臺Web服務器中的一臺,確保集群高可用。
  8. 與Web服務器建立連接
    客戶端與目標Web服務器通過TCP三次握手建立連接。HTTP協議默認使用端口80,HTTPS(TLS加密)使用端口443
  9. Web服務器處理請求
    Web服務器(如Apache、Nginx)接收HTTP GET請求,解析請求頭/請求路徑,定位靜態資源或轉發動態請求至應用服務器(如Tomcat、Node.js)。
  10. 應用層與數據庫交互
    動態請求由Web應用程序(如PHP/Python程序)執行業務邏輯,包括查詢/更新數據庫(如MySQL、Redis),生成動態內容(如用戶數據、實時信息)。
  11. 客戶端渲染與呈現
    瀏覽器接收響應(HTML/CSS/JS),執行以下流程:
    • 解析HTML → 構建DOM樹
    • 解析CSS → 構建CSSOM樹
    • 執行JavaScript → 動態修改DOM/CSSOM
    • 合并渲染樹 → 布局(Layout) → 繪制(Paint) → 最終呈現可視化網頁。

關鍵協議與技術說明

  • DNS解析:分層查詢機制(根→頂級域→權威域)確保全球域名可管理;
  • HTTPS安全擴展:在TCP握手后增加TLS協商(證書驗證+密鑰交換),加密傳輸數據;
  • 連接復用:HTTP/1.1默認Keep-Alive復用TCP連接,HTTP/2支持多路復用減少握手開銷;
  • 渲染阻塞:JS執行會暫停DOM/CSSOM構建,需優化加載策略。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/918555.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/918555.shtml
英文地址,請注明出處:http://en.pswp.cn/news/918555.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Python 閉包詳解:從變量作用域到實戰案例

一、變量作用域基礎在 Python 中&#xff0c;變量根據作用范圍可分為三類&#xff1a;全局變量&#xff1a;定義在函數外部的變量&#xff0c;作用范圍是整個程序。如果在函數內部需要修改全局變量&#xff0c;必須使用global關鍵字聲明。局部變量&#xff1a;定義在函數內部的…

Docker 跨主機容器之間的通信macvlan

默認一個物理網卡&#xff0c;只有一個物理mac地址&#xff0c;虛擬多個mac地址 缺點&#xff1a;每次需要手動配置ip地址&#xff0c;容易ip地址沖突。類似于保存到execl表格里面。 兩臺物理機&#xff1a; docker-01和docker-02 創建macvlan網絡 [rootdocker-01 ~]# docker n…

android 換膚框架詳解1-換膚邏輯基本

android 換膚框架詳解1-換膚邏輯基本-CSDN博客 android 換膚框架詳解2-LayoutInflater源碼解析-CSDN博客 android 換膚框架詳解3-自動換膚原理梳理-CSDN博客 換膚框架流程 1&#xff0c;通過AssetManager獲取換膚的資源文件 2&#xff0c;通過原文件中的resId獲取到res名稱…

NEON性能優化總結

轉自 NEON優化&#xff1a;性能優化經驗總結-CSDN博客 NEON優化&#xff1a;性能優化經驗總結 1. 什么是 NEON Arm Adv SIMD 歷史 2. 寄存器 3. NEON 命名方式 4. 優化技巧 5. 優化 NEON 代碼(Armv7-A內容&#xff0c;但區別不大) 5.1 優化 NEON 匯編代碼 …

計算機網絡摘星題庫800題筆記 第2章 物理層

第2章 物理層2.1 物理層概述題組闖關1.采用以下哪種設備&#xff0c;可以使數字信號傳輸得更遠 ( )。 A. 放大器 B. 中繼器 C. 網橋 D. 路由器1.【參考答案】B 【解析】選項 A 放大器只是單純地放大信號、抑制噪音和干擾。選項 B 中繼器是把一根線纜中的電或者光信號傳遞給另一…

導入文件到iPhone實現

我們有時候開發需要加載一些自己的文件&#xff0c;這個時候就需要導入文件到iPhone等設備。在info里面open as source code&#xff0c;加入如下配置&#xff1a;<!-- 開啟 iTunes / Finder 文件共享 --><key>UIFileSharingEnabled</key><true/>或者o…

Ubuntu Server系統安裝磁盤分區方案

最近打算把家里的舊電腦利用起來&#xff0c;裝上Ubuntu Server 24.04.3 LTS作為一個家用NAS服務器&#xff0c;但是給舊電腦安裝系統時遇到了一些問題&#xff0c;遂記錄下來 GPT分區與MBR分區 GPT 指的是 GUID Partition Table&#xff08;全局唯一標識分區表&#xff09;&am…

1小時 MySQL 數據庫基礎速通

目錄 一、MySQL安裝配置 1、下載mysql 2、下載mysql-shell 二、MySQL基本概念 1. 數據庫&#xff08;Database&#xff09; 2. 表&#xff08;Table&#xff09; 3. 數據類型&#xff08;Data Type&#xff09; 4. 主鍵&#xff08;Primary Key&#xff09; 5. 索引&am…

HTTP應用層協議-長連接

HTTP應用層協議-長連接 關于 connection 報頭 HTTP 中的 Connection 字段是 HTTP 報文頭的一部分&#xff0c;它主要用于控制和管理客戶端與服務器之間的連接狀態 核心作用 ? 管理持久連接&#xff1a;Connection 字段還用于管理持久連接&#xff08;也稱為長連接&#xff09;…

2020/12 JLPT聽力原文 問題一 4番

4番&#xff1a;ホテルの受付で女の人と男の人が話しています。女の人はどこでパソコンを使いますか。女&#xff1a;すみません、パソコンの貸出ってできますか。部屋で仕事をしたいんですけど。 男&#xff1a;申し訳ございません。貸出はしていないんですが、二階にビジネス…

《在 Spring Boot 中安全使用 Qwen API-KEY:環境變量替代明文配置的最佳實踐》

《在 Spring Boot 中安全使用 Qwen API-KEY&#xff1a;環境變量替代明文配置的最佳實踐》 想要的效果其實就是 把 Qwen API-KEY 放到系統環境變量中&#xff0c;然后在 application.yml 里通過占位符讀取&#xff0c;而不寫明文。 這樣即便 application.yml 被提交到 Git&…

Nginx 反向代理與負載均衡架構

一、反向代理基礎 實驗目的&#xff1a;通過 Nginx 反向代理&#xff0c;將客戶端請求按類型&#xff08;靜態頁面 / 動態 PHP 頁面&#xff09;轉發到不同的后端服務器&#xff08;RS1 處理靜態資源&#xff0c;RS2 處理動態請求&#xff09;&#xff0c;實現 “客戶端只與代…

【Mybatis入門】配置Mybatis(IDEA)

Mybatis和JDBC一樣&#xff0c;是連接數據庫的工具。它是一款優秀的持久層框架&#xff0c;主要用于 Java 語言中簡化數據庫操作&#xff0c;實現對象與數據庫表之間的映射。Mybatis相比于JDBC的優勢Mybatis消除了傳統 JDBC 代碼中繁瑣的手動處理、參數設置、結果集解析等重復工…

多路轉接之epoll 【接口】【細節問題】【LT與ET模式】【Reactor】

目錄 一.接口 1.1epoll_creaet 1.2epoll_ctl 1.3epoll_wait 二.細節問題 2.1 工作原理 2.2 epoll的demo 2.3 epoll的優點 三. LT 與 ET模式 理解ET 四. reactor 一.接口 1.1epoll_creaet 注意返回值是一個文件描述符 創建一個epoll模型 1.2epoll_ctl 返回值&…

滲透測試現已成為 CISO 戰略的核心

隨著數字供應鏈的擴展以及生成式人工智能在關鍵系統中的嵌入&#xff0c;安全領導者正在重新思考其網絡安全策略。Emerald Research 最近對 225 位安全領導者進行的一項調查發現&#xff0c;68% 的人擔心第三方軟件和組件帶來的風險。雖然大多數受訪者表示他們正在滿足監管要求…

音視頻學習(五十三):音頻重采樣

概述 音頻重采樣&#xff08;sample rate conversion, SRC&#xff09;是把采樣率從 Fs_in 變換為 Fs_out 的過程。常見場景有格式轉換&#xff08;44.1→48 kHz&#xff09;、采樣率匹配&#xff08;播放鏈路統一采樣率&#xff09;、以及通信中語音采樣率升降&#xff08;8 k…

【C#】正則表達式

一、核心優勢&#xff1a;用一小段規則搞定大量復雜的字符串匹配&#xff0c;查找和替換&#xff0c;并且可移植可復用。使用正則表達式的好處&#xff1a;1. 強大且靈活&#xff1a;可以一次性匹配非常復雜的規則&#xff0c;比如驗證郵箱、提取特定的格式日志、解析URL&#…

【[特殊字符][特殊字符] 協變與逆變:用“動物收容所”講清楚 PHP 類型的“靈活繼承”】

你有沒有遇到過這樣的問題&#xff1a;“為什么子類方法可以返回 Cat&#xff0c;而父類只寫了返回 Animal&#xff1f;” “為什么參數反而能從 CatFood 變成更寬泛的 Food&#xff1f;”這些看似“違反直覺”的設計&#xff0c;其實背后有一個優雅的編程概念&#xff1a;協變…

cesium/resium 修改子模型材質

我是 www.v2ex.com/t/1151549 的作者&#xff0c;在csdn這邊補全一些更多的信息 相關工具 主項目插件版本&#xff1a; "cesium": "^1.131.0",、"resium": "^1.19.0-beta.1"、"three": "^0.178.0"、"react…

nvm install 14.21.3 時npm 無法下載和識別

錯誤&#xff1a;C:\Users\H3C>nvm install 14.21.3 Downloading node.js version 14.21.3 (64-bit)... Complete Downloading npm... Creating C:\Users\H3C\AppData\Local\Temp\nvm-install-939491942\temp Downloading npm version 6.14.18... Error while downloading h…