How web servers work

The process of accessing a web page

I typed a URL(http://www.xxx.com/index.html) into  my browser and press enter.


The browser broke the URL into three parts: 

The protocol("http")

The server name ("www.xxx.com")

The file name ("index.html")


The browser communicated with a name server to translate the server name "www.xxx.com" into IP Address, which it uses to connect to the server machine. The browser then formed a connection to that server at that IP Address on port 80.


Following the HTTP protocol, the browser sent a GET request to the server, asking for the file ("index.html").


The server then sent the html text for the web page to the browser. The browser read the html tags and formatted the page onto my screen.


The Internet

It's a collection of millions of computers, all linked together on a computer network. The network allows all of the computers to communicate with one another. 


Clients and Servers

Those machines that provide services to other machines are servers. And the machines that are used to connect to those services are clients.


IP Address

To keep all of these machines straight, each machine on the Internet is assigned a unique address called an IP address. IP stands for Internet protocol, and these addresses are 32-bit numbers, normally expressed as four "octets" in a "dotted decimal number." 


Domain Names

Because most people have trouble remembering the strings of numbers that make up IP Addresses, and because IP addresses sometimes need to change, all servers on the internet also have human-readable names, called domain names. The name https://www.google.com is a permanent, human-readable name. It is easier for most of us to remember. The name https://www.google.com actually has three parts:

1. The host name ("www")

2. The domain name ("google")

3. The top-level domain name ("com")


Name Servers

A set of servers called domain name servers(DNS) maps the human-readable names to the IP addresses. These servers are simple databases that map names to IP addresses. and they are distributed all over the internet. Most individual companies, ISPs and universities maintain small name servers to map host names to IP addresses.


Ports

Any server machine makes its services available to the internet using numbered ports, one for each service that is available on the server. 

For example, if a server machine is running a Web server and an FTP server, the Web server would typically be available on port 80, and the FTP server would be available on port 21. Clients connect to a service at a specific IP address and on a specific port.

Each of the most well-known services is available at a well-known port number. Here are some common port numbers:

  • echo 7
  • daytime 13
  • qotd 17 (Quote of the Day)
  • ftp 21
  • telnet 23
  • smtp 25 (Simple Mail Transfer, meaning e-mail)
  • time 37
  • nameserver 53
  • nicname 43 (Who Is)
  • gopher 70
  • finger 79
  • WWW 80

Protocol

Once a client has connected to a service on a particular port, it accesses the service using a specific protocol. The protocol is the pre-defined way that someone who wants to use a service talks with that service. The "someone" could be a person, but more often it is a computer program like a Web browser. Protocols are often text, and simply describe how the client and server will have their conversation.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值