事前準備
セキュリティグループで10280ポートフルオープンで空けとく
ディレクトリ移動しないでね
sudo yum -y install nmap-ncat
sudo vi index.html.sh
-----以下の点線内ををそのまま貼ってね------
#!/bin/bash
echo -e "HTTP/1.1 200 OK\r\n$(date)\r\nContent-Type: text/html; charset=utf-8\r\n\r\n"
echo "<html><body><p>Hello world</p></body></html>"
----------------------------------------
sudo chmod 777 index.html.sh
nc -l 10280 -k -e index.html.sh
ハイ終了^^
ブラウザで以下入力してアクセス
サーバーのIP:10280
秒でしょ?
より早いの
sudo yum -y install nmap-ncat
(echo "HTTP/1.1 200 OK\r\n$(date)\r\nContent-Type: text/html; charset=utf-8\r\n\r\n";echo;echo "<html><body><p>Hello world</p></body></html>") | nc -lk 12080
失敗するとサーバ側にこれしか出ない
GET / HTTP/1.1
Host: ホストのIP:12080
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: ja
成功すると
Host: ホストのIP:12080
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: ja
GET /favicon.ico HTTP/1.1
Host: ホストのIP:12080
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
Referer: http://3.115.5.128:12080/
Accept-Encoding: gzip, deflate
Accept-Language: ja