V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
qw7692336
V2EX  ›  问与答

ubuntu 如何通过命令行,快速在当前目录下开启一个 web 服务器?想实现的操作如下

  •  
  •   qw7692336 · 2015-07-09 10:35:25 +08:00 · 1784 次点击
    这是一个创建于 3215 天前的主题,其中的信息可能已经有所发展或是发生改变。

    cd /home/v2ex
    echo yellow > color.html
    webserver run
    curl http://127.0.0.1/color.html

    第 1 条附言  ·  2015-07-10 11:04:54 +08:00
    似乎 npm start即可
    @learnshare 提供的anywhere也很方便
    第 2 条附言  ·  2015-07-10 11:07:20 +08:00
    好吧npm start并不是在任意目录下都可以
    5 条回复    2015-07-09 10:59:26 +08:00
    ryd994
        1
    ryd994  
       2015-07-09 10:44:36 +08:00 via Android
    python -m SimpleHTTPServer
    wesley
        2
    wesley  
       2015-07-09 10:50:23 +08:00
    php -S 0.0.0.0:80
    learnshare
        3
    learnshare  
       2015-07-09 10:52:48 +08:00   ❤️ 1
    imlonghao
        4
    imlonghao  
       2015-07-09 10:57:10 +08:00 via Android
    python -m SimpleHTTPServer
    python3 -m http.server
    azglze
        5
    azglze  
       2015-07-09 10:59:26 +08:00
    For Python3:
    "
    python3 -m http.server (--cgi) <port>
    "
    It can serve as a cgi server.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   877 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:54 · PVG 05:54 · LAX 14:54 · JFK 17:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.