Module 4: web servers
Migration
Module 4: web server and web pages (html)
see also https://elab.hpa.edu/cs/TC/TC%205.0%20HTML.pdf
Background:
- html stands for hypertext markup language
- it is a markup language, not really programming like python or C
- it manages how information is presented ("marked up") for viewers
- others include xml and xhtml, both managing data as well as format (more on this soon)
Installing a web server:
- On the raspberry pi, run the following commands:
- sudo apt-get update (this updates your computer)
- sudo apt-get install apache2 -y (this installs apache web server on your computer, answering yes to all prompts)
- Go your browser and enter 127.0.0.1 (which means "me" on the internet)
- Now type ifconfig in
progressyour terminal and look forAppleyourWikiinternet address, which should start with 10.14.x.y - Look at this address using your browser
Setup your web folder, edit a page:
Making a new web page:
- cd to the /var/www/html directory and look around (ls -la)
- Using either nano create a new page:
- sudo nano /var/www/html/test.html
- You'll notice this is blank.
- Add the following to your new web page:
<html>
<head>
test
</head>
<body>
Wow, this is really easy
</body>
</html>
- remember to overwrite (ctrl-o) and exit (ctrl-x)
- Now go to your browser and enter http://127.0.0.1/test.html
- What do you see?
- Create your own pages in your html folder and test
Using a text editor to edit and create pages:
- use the folder browser to navigate to the /var/www/html folder
- open a text editor and create a page called test2.html
- add code as you did with the nano editor
- save and test
- create a new folder on your web server
- create a document there with secret content
- challenge your friends to find this page
Remote web page creation:
- ssh into 10.14.88.81 (pi-alpha.hpa.edu) as pi/papaya77
- navigate to the /var/www/html folder
- create a folder with your name (short version all lowercase, no spaces)
- create a document in html inside the folder
- browse from your station to verify your new web site!
- challenge your friends to read your secret message
Next steps: https://www.w3schools.com/
- create some pages using the w3schools tutorials
- copy this code into your local web server, test
- copy this code into the pi-alpha server, test
Migrated from Apple Server Wiki. Original page ID: w2Z0s3H0A