初音未来の消失

利用python搭建简易http服务器

正文

原料

linux系统(虚拟机),python

方法

首先cd到你想开服务器的目录下,再

sudo python -m SimpleHTTPServer [port]

e.g. sudo python -m SimpleHTTPServer 80

这样就在80端口开启了服务器

ubuntu:~/Desktop$ sudo python -m SimpleHTTPServer 80
Serving HTTP on 0.0.0.0 port 80 ...
192.168.133.1 - - [13/Jun/2019 05:05:26] "GET /x.jpg HTTP/1.1" 200 -
192.168.133.1 - - [13/Jun/2019 05:05:26] code 404, message File not found
192.168.133.1 - - [13/Jun/2019 05:05:26] "GET /favicon.ico HTTP/1.1" 404 -
192.168.133.1 - - [13/Jun/2019 05:06:32] "GET /x.jpg HTTP/1.1" 200 -
192.168.133.1 - - [13/Jun/2019 05:07:00] "GET /x.jpg HTTP/1.1" 200 -
192.168.133.1 - - [13/Jun/2019 05:15:58] "GET /x.jpg HTTP/1.1" 200 -
192.168.133.1 - - [13/Jun/2019 05:18:36] "GET /x.jpg HTTP/1.1" 200 -
192.168.133.1 - - [13/Jun/2019 05:20:23] "GET /x.jpg HTTP/1.1" 200 -
192.168.133.1 - - [13/Jun/2019 05:37:08] "GET /x.jpg HTTP/1.1" 200 -
192.168.133.1 - - [13/Jun/2019 05:38:55] "GET /x.jpg HTTP/1.1" 200 -

正常读取到http服务器下面的x.jpg

退出移动版