开启文件服务器
# python2 python -m SimpleHTTPServer # python3 python3 -m http.server # 指定端口,默认8000 python3 -m http.server 8080 # 指定ip python3 -m http.server 8080 --bind 127.0.0.1 # 指定目录 python3 -m http.server 8080 --bind 0.0.0.0 -d /tmp/
默认为8000端口
解决编码问题
# Python3 指定端口8080 python3 -c "from http.server import test, SimpleHTTPRequestHandler as RH; RH.extensions_map={k:v+';charset=UTF-8' for k,v in RH.extensions_map.items()}; test(RH)" 8080