一、确定iStoreOS 是否使用uHTTPd
作为 Web 服务器。
运行以下命令:
ps | grep httpd
如果返回类似:
9783 root 4716 S /usr/sbin/uhttpd -f -h /www ...
说明系统正在使用 uHTTPd
。
如果没有结果,说明 uHTTPd
可能未运行。
二、配置 HTTPS 访问
按照 uHTTPd 方式 配置 HTTPS 访问。
1:安装 SSL 证书工具
首先,确保 px5g-wolfssl
已安装:
opkg update
opkg install px5g-wolfssl
2:生成自签名证书
让 uHTTPd
生成 SSL 证书:
/etc/init.d/uhttpd stop
rm -f /etc/uhttpd.key /etc/uhttpd.crt
uhttpd -d /etc -p 2048 -c /etc/uhttpd.crt -k /etc/uhttpd.key -C 'CN=10.10.10.1'
如果想用 openssl
生成:
openssl req -x509 -newkey rsa:2048 -keyout /etc/uhttpd.key -out /etc/uhttpd.crt -days 365 -nodes -subj "/C=CN/ST=YourState/L=YourCity/O=iStoreOS/CN=10.10.10.1"
⚠️ 这里 CN=10.10.10.1
需要改成你的 iStoreOS IP(比如 192.168.1.1
)。
3:修改 uHTTPd
配置
编辑 /etc/config/uhttpd
,找到 config uhttpd 'main'
这部分,确保以下内容正确:
config uhttpd 'main'
option redirect_https '1' # 自动重定向 HTTP 到 HTTPS
option cert '/etc/uhttpd.crt'
option key '/etc/uhttpd.key'
4:重启 uHTTPd
/etc/init.d/uhttpd restart
5:测试 HTTPS 访问
打开浏览器,输入:
https://10.10.10.1
(如果你的 iStoreOS 设备 IP 是 192.168.1.1
,则访问 https://192.168.1.1
)
⚠️ 浏览器可能会提示“证书不受信任”,因为这是自签名证书。你可以手动信任它,或者导入到系统的受信任证书列表。
总结
- 如果使用的是
uHTTPd
, HTTPS 配置方式跟 OpenWrt 类似。 - 必须生成 SSL 证书(可以用
px5g-wolfssl
或openssl
)。 - 修改
/etc/config/uhttpd
配置文件,设置 HTTPS 相关参数。 - 重启
uHTTPd
,然后访问https://你的IP
。
这样,你的 iStoreOS 就能通过 HTTPS 访问了!🚀