David Nguyen, Colin Yang
Linux User Group @ UCLA
2017-04-11
Colin Yang
POST /post HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 11
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: httpbin.org
User-Agent: HTTPie/0.9.2
hello=world
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json
Date: Wed, 12 Apr 2017 00:50:45 GMT
Server: gunicorn/19.7.1
Via: 1.1 vegur
{"user-agent": "HTTPie/0.9.2"}
GET
POST
HEAD
OPTIONS
PUT
DELETE
Host
: specifying the hostnameUser-Agent
: program making the requestLocation
: used for redirectionContent-Type
: MIME type (ignore this term)200
: ok301
, 302
: redirection404
: not found (client error)500
: internal server errorssh root@<ip>
or ssh <ip> -l root
ncat
from nmap
packagesudo apt install nmap
$ ncat --crlf google.com 80
GET / HTTP/1.1
Host: google.com
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
<... omitted>
$ ncat --crlf --ssl google.com 443 # --ssl for HTTPS
GET / HTTP/1.1
Host: www.google.com
HTTP/1.1 200 OK
<... omitted>
curl
: sudo apt install curl
httpie
: sudo apt install httpie
David Nguyen
ssh -l root <ip-address>
lsb_release -a
echo "deb http://nginx.org/packages/ubuntu/ xenial nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/ubuntu/ xenial nginx" >> /etc/apt/sources.list
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
apt update
apt install nginx
iptables -A INPUT tcp -m tcp --dport 80 -j ACCEPT
Configration files will be in /etc/nginx/nginx.conf
In the server root we will add an index page:
echo "Hello World!" > <server root>/index.html
curl -v <ip address>