Professional Documents
Culture Documents
CS100 Module12 DeployingWebsites 1-2023
CS100 Module12 DeployingWebsites 1-2023
Module 12:
Deploying Websites
By CS100 Instructor Team
Department of Computer Science
Faculty of Science & Technology, Thammasat University
Last update: August 2023
Accessing Websites
● Client-Server Model:
HTTP Request & Response
● Client (e.g., Web Browser):
○ Sends HTTP requests to servers.
● Key Concepts:
○ URL (Uniform Resource Locator): Specifies where the requested data can be found.
○ HTTP Methods: Different types of requests like GET (retrieve), POST (submit data), PUT (update), DELETE.
○ HTTP Status Codes: Indicate the result of the request (e.g., 200 for success, 404 for not found).
2
Outline
● Basic of Web Hosting
○ Fundamental components of web servers
○ Network IP Address & Port
○ Document root directory
○ Security with firewall and key pair
5
Fundamental Components of Web Servers
Hardware components Software components
Processor (CPU): Operating System:
● The central unit that processes instructions. ● The primary software that manages hardware resources, e.g., Linux
● Faster processors can handle more simultaneous requests. (Ubuntu, CentOS), Windows Server.
Credit:
https://www.homenethowto.com/basics/ip-addresses/
https://www.dispersednet.com/redhat-system-admin/module4/define-port-numbers.php
8
Document Root Directory
● The "home" directory of your website
● Default location where web server looks File path on the Internet (accessible via a URL)
for files to display
○ Apache: Often found as /var/www/html
on Linux systems.
○ Nginx: Default might be
/usr/share/nginx/html or
/var/www/nginx on some systems.
● Acts as the starting point for your File path on the Web Server
website's file hierarchy credit: http://www.cellbiol.com/bioinformatics_web_development/chapter-3-your-first-web-page-learning-html-and-
css/hosts-domains-and-urls/
9
Security with Firewall
● Firewall: A network security system that monitors and filters incoming and outgoing network
traffic based on predetermined security policies.
○ Analogy: Think of a firewall as a security guard at the entrance of a building, deciding who can enter and
who can't based on a set of rules.
10 credit: https://www.quora.com/What-is-a-firewall-and-why-would-you-install-one-on-a-VPS
Security with Key Pair
● Key Pair: comprises two interconnected cryptographic keys: a public key and a private key.
● Public Key is like a lock on your front door.
○ Usage: Encrypt data or verify a signature.
○ Visibility: Can be shared openly without risk.
● Private Key is like the unique key that opens the lock on your front door.
○ Usage: Decrypt data or sign digital signatures.
○ Visibility: Must remain secret and secure. If lost or exposed, security is compromised.
11 credit: https://cheapsslweb.com/blog/what-is-a-public-and-private-key-pair
Hands-on with AWS
Cloud and EC2
12
Where to Host Your Websites
● Cloud Server:
○ A virtual server hosted on a platform provided by a third-party cloud service provider (e.g., AWS, Azure, Google Cloud).
○ Ideal for businesses looking for flexibility, scalability, and reduced overhead, especially startups and those with
fluctuating demands.
● Features:
○ On-Demand: Quickly launch, scale, and terminate virtual servers.
○ Customizable: Variety of instance types tailored for different use-cases.
○ Integrated: Works seamlessly with other AWS services.
○ Secure: Set up in network isolation and other security mechanisms.
15
AWS Academy Learner Lab (cont.)
● You will see the
AWS Academy
Learner Lab in
the Dashboard
● Select ‘Launch
AWS Academy
Learner Lab’
● Agree to all lab’s
agreements
● Click ‘Start Lab’
and wait until
the circle next to
AWS turn green
16
Accessing Amazon EC2 via AWS Console
17
Configuring EC2 Instances
#!/bin/bash
# Use this for your user data (script from
top to bottom)
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd
systemctl start httpd
Start the Web Server
systemctl enable httpd
echo "<h1>Hello World from $(hostname -
f)</h1>" > /var/www/html/index.html
19
Checking out the deployed website
● View details of the successfully
launched instance
● View the example website in your
browser
20
Hands-On Activity
● Try launching an Amazon EC2 instance as shown in the previous example
○ Revisit Slide #6 again
○ Try your best to identify how each component can be identified in this example, note them down.
22
Discussion: Hands-On Activity (cont.)
Hardware components Software components
Processor (CPU): Operating System:
● 1 vCPU ● Amazon Linux 2023 (AL2023) - Fedora + CentOS
23
END
32 TITLE 24