Understanding Web Servers

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

A web server is responsible for delivering the content of hosted websites to the end user's device. What else does it primarily manage?

  • Email communications between users.
  • HTTP/HTTPS requests and responses. (correct)
  • Physical data interchange with other devices connected to a local network
  • Operating system updates for client devices.

A web developer is deciding between using a static server and a dynamic server for a new project. Which factor would most strongly suggest the need for a dynamic server?

  • The website will primarily serve pre-existing HTML documents, CSS, and JavaScript files.
  • The website will be hosted on a free cloud-based platform.
  • The website will rely heavily on user-generated content and real-time data updates. (correct)
  • The website requires minimal server-side processing.

When constructing a URL to access a specific HTML document within a static server's directory, which pieces of information are essential?

  • The server's domain name, the root directory name, and the document's file size.
  • The server's IP address and the exact file path to the document.
  • The server's IP address, the port number the server is running on, and the location of the document. (correct)
  • The server's domain name, the client's MAC address, and the document's last modified date.

When is the POST method preferred over the GET method in HTTP communication?

<p>When sending substantial amounts of data to be processed on the server. (C)</p> Signup and view all the answers

While developing a website, a developer links a CSS file using a relative path in the HTML. What is the key advantage of using a relative path in this scenario?

<p>It allows the same <link> element to be used across all HTML documents, regardless of their location. (C)</p> Signup and view all the answers

Flashcards

What is an HTTP server?

Software that understands URLs and the Hypertext Transfer Protocol (HTTP).

What is a domain name?

Text that maps to an IP address, used to access websites. For example, 'google.com'.

What is a Web Server?

Accepts requests for static content and responds via HTTP. Helpful for static webpages.

Application Server

This is a server that delivers dynamic content for displaying results, enables interaction between the end-user and server-side code.

Signup and view all the flashcards

What is the GET method?

This HTTP method is used to request data from the server (e.g., typing a URL in the browser bar).

Signup and view all the flashcards

What is the POST method?

This HTTP method is used when the client sends data to be processed on the server. (e.g., submitting data to a database.)

Signup and view all the flashcards

Study Notes

Hosting a Website

  • Hosting a website involves having a server, web server software, handling requests, and providing appropriate responses.

Web Server Uses

  • Web servers manage HTTP/HTTPS requests and responses.
  • Web servers store and protect website data.
  • They control bandwidth to regulate network traffic.
  • Web servers are used for server-side web scripting and virtual hosting.

Web Server Function

  • An end user sends a request using a web browser installed on a web server.
  • Communication between a web server or browser and the end user takes place using HTTP.
  • A web server's primary role is to store, process, and deliver requested information or webpages to end users
  • Web servers involve physical storage for website files.
  • Web servers require a web browser to access and display content.

Web Servers Defined

  • A web server involves both hardware and software working in concert.
  • On the hardware side, it is a computer storing web server software and website component files, such as HTML documents, images, CSS stylesheets, and JavaScript files.
  • Web servers deliver files to the client device.
  • Web servers connect to the internet.
  • Web servers can be accessed through a URL like https://www.google.com/.
  • A web server connects to the Internet and supports physical data interchange with other devices connected to the web.
  • On the software side, a web server controls how web users access hosted files, at a minimum functioning as an HTTP server.

HTTP Servers and Domain Names

  • An HTTP server understands URLs and the HTTP, which is the protocol browsers use to view webpages.
  • An HTTP server delivers content via domain names of the websites it stores.
  • Static servers only have the HTTP server component.
  • Dynamic servers contain additional components.
  • A domain name maps to an alphanumeric IP address, which allows users to access a website replacing the need to know a particular IP address. "google.com" is an example of a domain name.

Domain Management

  • Domain names are managed by domain registries.
  • Registrars manage top-level domains (TLDs) like '.com' and '.net', maintaining records of domain ownership.
  • Anyone can register a domain name with a registrar. There are over 300 million registered domain names.

URL vs. Domain Name

  • A URL contains the domain name, protocol, and path to a specific page, such as 'https' which is the protocol and '/learning/' which is the path to a specific page on the website. https://cloudflare.com/learning/ is the full URL with 'cloudflare.com' as the domain name.

Client-Server Communication via HTTP

  • Web servers contain files and utilize an HTTP server to communicate with browsers.
  • Browsers send HTTP requests to web servers and receive HTTP responses.

Static vs Dynamic Web Servers

  • Websites need either a static or dynamic web server to be published.
  • A static web server consists of computer hardware and HTTP server software. Static web servers send hosted files as-is to the browser.
  • A dynamic web server consists of a static web server, an application server, and a database. Dynamic web servers update hosted files before sending content to the browser via the HTTP server.

Static Servers Specifics

  • Static servers consist of computer hardware and HTTP server software.
  • Static servers only respond to GET requests for pre-existing HTML documents/files to send to the browser.
  • Loading an HTML document in a static server can trigger additional GET requests from the browser for linked files like CSS, JavaScript, and images.

Dynamic Servers Specifics

  • Dynamic servers consist of an HTTP server plus extra software such as an application server and a database.
  • Dynamic servers use their application server and a database to assemble HTML code via server-side scripts and HTML templates.
  • Dynamic servers send dynamically assembled HTML content via HTTP, similar to static content.

Communicating through HTTP

  • HTTP specifies how communication between client and server takes place.
  • HTTP transfers hypertext like HTML documents.
  • FTP and WebSockets are other web communication protocols.
  • HTTP is the most common web protocol.
  • HTTPS is a secured version of HTTP that adds a layer of security through encrypted communication. HTTPS is not fundamentally different from HTTP.

HTTP Protocol Details

  • In web context, a protocol is a set of rules for communication between two computers.
  • HTTP is textual because all commands are plain-text, making them human-readable.
  • HTTP is stateless; neither the server nor the client remembers previous communications.
  • An HTTP server, relying only on HTTP, cannot remember login status or progress in a transaction.
  • Only clients can make HTTP requests, and servers can only respond to these requests.

HTTP Methods

  • HTTP protocol defines methods, or verbs, which indicate the desired action on the requested resource on the server.
  • GET and POST are two of the most common HTTP methods for requests and responses between client and server.
  • GET requests data from the server.
  • POST submits data to be processed on the server.
  • PUT and DELETE are also HTTP methods but used more rarely.

The GET Method

  • The GET method requests data.
  • Typing a URL in a browser's address bar results in a GET request being sent to the server.
  • Static servers can process GET requests if the requested file is physically available.
  • The response to a GET request is usually an HTML document displayed in the browser.
  • GET requests can be sent programmatically or manually.

The POST Method

  • The POST method sends data to be processed on the server.
  • POST is less common and more complicated than GET.
  • POST requests cannot be sent by typing a URL in the browser.
  • POST requests require code, like JavaScript.
  • Dynamic servers process POST requests using server-side scripts to handle the received data.
  • POST requests are preferred when sending substantial amounts of data to the server.

Available Software

  • HTTP servers are included in many software packages and libraries, and they do not require special installation or configuration.
  • Free cloud-based options exist to have a managed static server like GitHub Pages.
  • Apache HTTP Server and Nginx are professional HTTP server software packages used for building static and dynamic servers.

Web Server Software List

  • Common web server software includes Linux web server software
  • Common web server software includes NGINX web server software
  • Common web server software includes Apache web server software
  • Common web server software includes IIS web server software

Web Server vs. Application Server Differences

  • Web servers accept and process requests for static website content and handle HTTP requests/responses. They help serve static content or HTML webpages, use fewer resources, and provide a runtime environment for web applications.
  • Application servers deliver web and dynamic content required for things like decision support, use web containers, use more resources compared to web servers, enable user interaction with server-side code, and support HTTP and RPC/RMI protocols.

Practical Considerations for Server Choice

  • Static sites are simple, fast, and cheap, but complex sites are harder to maintain and can be impersonal.
  • Dynamic sites offer more flexibility, are easier to modify, but are slower, more expensive, and are more technically challenging.

URLs and File Structure

  • Static servers are associated with a directory on a computer, serving its contents over the web.
  • Clients can request any HTML document (or file) within the directory or its sub-directories by entering a URL in the browser.
  • The right URL requires the IP address of the host computer and the port where the server is running, or the domain name.

URL Components

  • Common components of a URL: http:// indicates HTTP communication, automatically completed by the browser.
  • An IP address identifies the web server.
  • The port number indicates where the server is running; default ports (80 for HTTP, 443 for HTTPS) can be omitted.
  • The document location specifies the file path, indicating sub-directories and the HTML document name.

URLs and File Names

  • Even if the specific HTML file name is omitted, the index.html page is still displayed.
  • Standard protocol dictates that a directory defaults to the index.html file.
  • The index.html file is typically the first page users see on a website.
  • Navigation usually goes to a textual URL such as https://www.google.com, rather than a numeric IP address and port number, such as http://216.58.198.68:80/.

Domain Name Server (DNS)

  • The Domain Name Server (DNS) resolves the domain name into the IP address for the appropriate web server.
  • Domain Name Server (DNS) makes information easier to remember because textual addresses can be used instead of numeric IP addresses.

File Structure Basics

  • Website files are in the root directory or in sub-directories.
  • In the example, www is given as the root directory.
  • The root directory contains a default index.html document. Browsing to the directory address without a specific file name displays the index.html file by default.
  • The root directory can also contain sub-directories.

Subdirectories

  • Sub-directories store additional files linked to the HTML code of index.html.
  • css sub-directories store CSS files (.css).
  • images sub-directories store images.
  • js sub-directories store JavaScript files (.js).
  • Sub-directories structures are for easy website maintenance.

Relative Paths

  • Relative paths specify the location of various files/images from the images folder inside of index.html by using code.
  • Use as a relative path to the root directory of the server.
  • Use as a relative path to the current directory.

CSS and JavaScript

  • CSS and JavaScript code can be loaded from separate files, usually ending in .css and .js, respectively.
  • Keeping CSS and JavaScript code in separate files takes a little more effort than embedding it directly in the HTML document, but saves work as our sites become more complex for two key reasons: CSS and Javascript can be used on multiple pages, and updates to CSS or Javascript are immediately reflected on all pages.

Linking CSS

  • Linking an external CSS file can be done using the element within the of the HTML document.
  • The CSS file can be linked to the index.html document be including the following element:
  • It makes sense to use a relative path which is relative to the root directory, since a website usually has a single set of CSS and JavaScript files.

Linking JavaScript

  • Linking a JavaScript code file can be done by adding a file path in the src attribute of a <script> element, for example <script src="/js/main.js"></script>
  • The <script> element can then be placed in the or the of the HTML document.
  • A relative path, relative to the root directory, is being used.

Static Servers

  • Topics related to running a static server are: Communication through HTTP, difference between static and dynamic servers, components of a URL, and the file structure on the server.
  • Experiment with running a static web server using a local server, using your own computer and Python and a remote server, using the GitHub Pages platform.

Remote Static Servers

  • Python's HTTP server is simple enough to start working with, but has issues if use intend to use it for production, i.e., in real-life scenarios, where stability is essential.
  • In real-life scenarios, you need to take care of the network administration issues, ensure your server has an IP address that can be reached from other computers, and that the server is not behind a firewall. You have to make sure the IP address of the computer always stays the same, and make sure the server is restarted in case the computer restarts, and so on.
  • A remote hosting service handles hardware, software and network.

GitHub Pages

  • There are numerous hosting services for static webpages, such as Google and Amazon, also smaller options exist that are paid.
  • GitHub is used as a platform for static web page hosting and allows for free use.
  • GitHub mainly stores Git repositories and enable collaborative code development that has static server functionality.
  • Advantages of using GitHub Pages are that it is "simple, free, and part of GitHub, a popular platform for collaborative code development"
  • A good alternative to GitHub Pages is surge.sh which is free, quicker to set up, but requires using the command line.

Git and GitHub

  • Git allows code to be tracked and kept in track.
  • It also allow changes to be undone.
  • Git is beneficial when integrating projects with multiple collaborators.
  • Git uses version-control systems.

GitHub Details

  • GitHub is a web-based Git repository hosting service.
  • Git projects are called repositories.
  • GitHub allows facilities to interact with others and to create community collabartions.
  • GitHub is used for open-source software development.
  • GitHub Pages serves the contents of the repository.
  • The contents of the repository will be automatically hosted at the following address: https://GITHUB_USER_NAME.github.io/REPOSITORY_NAME/
  • GITHUB_USER_NAME is the username and REPOSITORY_NAME is the repository name
  • The only difference is that the served directory is stored on another, remote server, rather than your own computer from using remote hosting.
  • in order for a web page to be loaded when one enters a repository URL, you need to have an index.html file in the root directory of your GitHub repository

Types of Website Hosting Services

  • Shared hosting is suitable for small websites, blogs, and small businesses. They allow multiple websites to share the same server resources, making hosting costs very affordable. Bluehost is a common provider.
  • VPS hosting is still a shared hosting environment, but provides a flexible set of resources to handle large traffic spikes, best for medium-sized businesses or eCommerce stores. HostGator is a common provider.
  • Managed WordPress hosting is a specialized hosting service made specifically for WordPress which lets client focus on content creation.

Dedicated Hosting

  • Dedicated server hosting lets you have the entire server dedicated to the client's website.
  • Client has management skills, advanced tools and ability to install your own tools such as operating systems. It is a fit for larger websites that need high-performance to tackle higher traffic volume.

Questions and Answers

  • A web server is a system that processes requests and delivers web content. Kinds of Servers. Include static and dynamic servers.
  • An HTTP is the Hypertext Transfer Protocol and is the core protocol for communication on the Web
  • A URL is a complete web address while a domain name is like the name of the website only.
  • Web server software that can be used includes Apache, Nginx, and IIS.
  • Web hosting involves having your website hosted on their Web Server for a fee.
  • The World Wide Web is a massive collection of web sites, all hosted on computers.
  • The web server (computer) where your website's HTML files, graphics, etc. reside is known as the web server.
  • WWW is the acronym of the World Wide Web.
  • The Web is a computer network all over the world wide.
  • All the computers in the Web can communicate or transfer the data(text file) and graphics (picture file) with each other. This is true.
  • A Web browser access the web page from a web server by a request.
  • A request is a standard HTTP request containing a domain address.
  • The DNS service is used to resolve the domain names to IP addresses.
  • An ISP (Internet Service Provider) connects you to websites, etc.
  • A domain name is the unique text name corresponding to the numeric IP address of a computer on the Internet.
  • A dot(.) is used as a separator in a domain name.
  • Users to your website will often connect via a modem.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Introduction to HTTP and Web Servers
10 questions
Web Servers and HTTP Communication
18 questions
Use Quizgecko on...
Browser
Browser