V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
tuding
V2EX  ›  Android

Android 手机上可以搭建本地 httpServer 吗?

  •  
  •   tuding · Oct 30, 2022 · 14572 views
    This topic created in 1285 days ago, the information mentioned may be changed or developed.

    如题, 想在 Android 手机上安装一个 http 服务器, 指向到手机上的某个目录, 就是 html+css+js, 不需要 php 数据库那些, 有现成的方案吗?

    最好是傻瓜一点的, 简单设置一下就可以

    手机没有 root

    14 replies    2022-11-21 16:52:56 +08:00
    Aloento
        1
    Aloento  
       Oct 30, 2022
    当然可以,X-plore File Manager 都能做到类似功能
    可以考虑写个小 App
    tuding
        2
    tuding  
    OP
       Oct 30, 2022
    @Aloento #1 写不来, 没学过
    X-plore File Manager 这个安装上了可以 http://127.0.0.1 访问吗?
    Ayahuasec
        3
    Ayahuasec  
       Oct 30, 2022 via Android   ❤️ 2
    可以装个 termux 然后 apt-get 随便装个 http server 就行了,比如 nginx 、apache ,或者不想写配置的话装个 python3 然后用 http.server 模块( python3 -m http.server --bind 127.0.0.1 8080 )
    没有 root 的话不能绑定低端口,绑一个 1024 以上的高端口就行了。
    另外就是用比较新版本的安卓的话,可能会在锁屏的时候杀开放端口连接的后台应用。
    darkengine
        4
    darkengine  
       Oct 30, 2022
    如果只是提供静态页面给本 app 展示,可以试试用
    webview.loadURL("file:///data/data/com.yourproject.example/files/index.html");
    连 http 服务器都不用起。
    tuding
        6
    tuding  
    OP
       Oct 31, 2022
    @Ayahuasec #3 much appreciated.
    elementp
        7
    elementp  
       Oct 31, 2022
    Mixplorer https://mixplorer.com/
    启用 http 服务器
    yolee599
        8
    yolee599  
       Oct 31, 2022 via Android
    KSWEB
    ByteRan
        9
    ByteRan  
       Oct 31, 2022   ❤️ 1
    opengps
        10
    opengps  
       Oct 31, 2022
    直接安装个旧手机工具箱,有你要的静态网页服务器功能
    kebing1011
        12
    kebing1011  
       Oct 31, 2022
    试试 Andorid 爱传送 app
    mtdhllf
        13
    mtdhllf  
       Nov 1, 2022
    买个服务器,几十块钱不贵,静态网站也简单,再装个宝塔面板,网页直接拖进去就行了
    stcode
        14
    stcode  
       Nov 21, 2022
    KSWEB 完美实现
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   994 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 19:05 · PVG 03:05 · LAX 12:05 · JFK 15:05
    ♥ Do have faith in what you're doing.