qw7692336
V2EX  ›  问与答

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

  •  
  •   qw7692336 · Jul 9, 2015 · 2659 views
    This topic created in 3987 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
        1
    ryd994  
       Jul 9, 2015 via Android
    python -m SimpleHTTPServer
    wesley
        2
    wesley  
       Jul 9, 2015
    php -S 0.0.0.0:80
    learnshare
        3
    learnshare  
       Jul 9, 2015   ❤️ 1
    imlonghao
        4
    imlonghao  
       Jul 9, 2015 via Android
    python -m SimpleHTTPServer
    python3 -m http.server
    azglze
        5
    azglze  
       Jul 9, 2015
    For Python3:
    "
    python3 -m http.server (--cgi) <port>
    "
    It can serve as a cgi server.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2835 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 15:16 · PVG 23:16 · LAX 08:16 · JFK 11:16
    ♥ Do have faith in what you're doing.