linux简单快速启用web

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.


serve 这是一个npm的模块,首先需要先安装 nodejs 和 npm,然后安装
$ npm install -g serve
$ serve     //当前目录为根目录,默认端口在3000的服务
$ serve --port 8000      //当前目录为根目录,指定端口在8000的服务
$ npm info serve
serve@11.3.0 | MIT | deps: 9 | versions: 133
Static file serving and directory listing
https://github.com/zeit/serve#readme


需要域名绑定的时候可以用apache或者nginx
jser.me/2013/11/22/快速启动web服务的两种方式.html
https://blog.csdn.net/hzhsan/article/details/44677867
https://blog.csdn.net/sun172270102/article/details/50820683
添加虚拟网卡
http://blog.51cto.com/mengzhaofu/1846545

===============

原文地址:https://www.cnblogs.com/sztom/p/10184599.html