Python的SimpleHTTPServer
需要先安装python,然后执行
$ python -m SimpleHTTPServer //当前目录为根目录,端口在8000的服务
$ python -m SimpleHTTPServer 9000 //当前目录为根目录,端口在9000的服务
为了更快速的使用,我们可以在.bashrc或者.zshrc里alias一下
alias servehere="python -m SimpleHTTPServer"
在命令行里,执行一下 $ servehere 就可以开启服务
$ python2
Python 2.7.17 (default, Mar 21 2020, 00:47:07)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
注意: python3 改为下面的命令了
$ python -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
$ python
Python 3.8.2 (default, Feb 26 2020, 22:21:03)
[GCC 9.2.1 20200130] on linux
Type "help", "copyright", "credits" or "license" for more information.