qw7692336
V2EX  ›  问与答

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

  •  
  •   qw7692336 · Jul 9, 2015 · 3014 views
    This topic created in 4139 days ago, the information mentioned may be changed or developed.

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

    Supplement 1  ·  Jul 10, 2015
    似乎 npm start即可
    @learnshare 提供的anywhere也很方便
    Supplement 2  ·  Jul 10, 2015
    好吧npm start并不是在任意目录下都可以
    5 replies  •  2015-07-09 10:59:26 +08:00
    ryd994
    ryd994
    Jul 9, 2015 via Android
    1
    python -m SimpleHTTPServer
    wesley
    wesley
    Jul 9, 2015
    2
    php -S 0.0.0.0:80
    learnshare
    learnshare
    Jul 9, 2015❤️1
    3
    imlonghao
    imlonghao
    Jul 9, 2015 via Android
    4
    python -m SimpleHTTPServer
    python3 -m http.server
    azglze
    azglze
    Jul 9, 2015
    5
    For Python3:
    "
    python3 -m http.server (--cgi) <port>
    "
    It can serve as a cgi server.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   695 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 19:55 · PVG 03:55 · LAX 11:55 · JFK 14:55
    ♥ Do have faith in what you're doing.