尝试在旧的 WRT54GS (v1.0) 上制作一个支持 php 的便携式 WiFi 网络服务器DD-WRT。我有 8MB 的闪存。我知道,这很难。我尝试了dd-wrt.v24-13064_VINT_openvpn_jffs_small.bin、optware 和lighttpd空间不足。现在我要尝试dd-wrt.v24-13064_VINT_mini.bin,但我只节省了 300KB,而且我认为这不会有什么区别。还有其他支持 php 的小型 http 服务器吗?哎呀,我甚至还没到可以添加 php 的地步!
也许我更想寻找一种在尝试安装之前计算 optware 软件包的大小和依赖关系的方法。
有任何想法吗?
答案1
这个与 DD-WRT 无关,但类似:
我在具有 8 MiB 闪存的设备上使用了 OpenWRT,并使用附带的 uhttpd 服务器作为 Web 服务器。
OpenWRT 的优势在于它的 squashfs 映像更小并且它的根目录位于 JFFS2 中并且可以编辑。
配置部分也很简单。有趣的文件是 /etc/config/uhttpd
# Server configuration
config uhttpd main
# HTTP listen addresses, multiple allowed
list listen_http 0.0.0.0:80
# list listen_http [::]:80
# HTTPS listen addresses, multiple allowed
list listen_https 0.0.0.0:443
# list listen_https [::]:443
# Server document root
option home /www
# Reject requests from RFC1918 IP addresses
# directed to the servers public IP(s).
# This is a DNS rebinding countermeasure.
option rfc1918_filter 1
# Certificate and private key for HTTPS.
# If no listen_https addresses are given,
# the key options are ignored.
option cert /etc/uhttpd.crt
option key /etc/uhttpd.key
# CGI url prefix, will be searched in docroot.
# Default is /cgi-bin
option cgi_prefix /cgi-bin
# List of extension->interpreter mappings.
# Files with an associated interpreter can
# be called outside of the CGI prefix and do
# not need to be executable.
# list interpreter ".php=/usr/bin/php-cgi"
# list interpreter ".cgi=/usr/bin/perl"
# Lua url prefix and handler script.
# Lua support is disabled if no prefix given.
# option lua_prefix /luci
# option lua_handler /usr/lib/lua/luci/sgi/uhttpd.lua
# CGI/Lua timeout, if the called script does not
# write data within the given amount of seconds,
# the server will terminate the request with
# 504 Gateway Timeout response.
option script_timeout 60
# Network timeout, if the current connection is
# blocked for the specified amount of seconds,
# the server will terminate the associated
# request process.
option network_timeout 30
# Basic auth realm, defaults to local hostname
# option realm OpenWrt
# Configuration file in busybox httpd format
# option config /etc/httpd.conf
# Server configuration
config uhttpd secondary
# HTTP listen addresses, multiple allowed
# list listen_http 0.0.0.0:80
list listen_http [::]:80
# HTTPS listen addresses, multiple allowed
# list listen_https 0.0.0.0:443
list listen_https [::]:443
# Server document root
option home /mnt/www
# Reject requests from RFC1918 IP addresses
# directed to the servers public IP(s).
# This is a DNS rebinding countermeasure.
option rfc1918_filter 1
# Certificate and private key for HTTPS.
# If no listen_https addresses are given,
# the key options are ignored.
option cert /etc/uhttpd.crt
option key /etc/uhttpd.key
# CGI url prefix, will be searched in docroot.
# Default is /cgi-bin
option cgi_prefix /cgi-bin
# List of extension->interpreter mappings.
# Files with an associated interpreter can
# be called outside of the CGI prefix and do
# not need to be executable.
# list interpreter ".php=/usr/bin/php-cgi"
# list interpreter ".cgi=/usr/bin/perl"
# Lua url prefix and handler script.
# Lua support is disabled if no prefix given.
# option lua_prefix /luci
# option lua_handler /usr/lib/lua/luci/sgi/uhttpd.lua
# CGI/Lua timeout, if the called script does not
# write data within the given amount of seconds,
# the server will terminate the request with
# 504 Gateway Timeout response.
option script_timeout 60
# Network timeout, if the current connection is
# blocked for the specified amount of seconds,
# the server will terminate the associated
# request process.
option network_timeout 30
# Basic auth realm, defaults to local hostname
# option realm OpenWrt
# Configuration file in busybox httpd format
# option config /etc/httpd.conf
# Certificate defaults for px5g key generator
config cert px5g
# Validity time
option days 730
# RSA key size
option bits 1024
# Location
option country DE
option state Berlin
option location Berlin
# Common name
option commonname OpenWrt
我使用配置 uhttpd 次要部分添加了一个新站点。只需复制配置 uhttpd 主要部分,编辑它并以新名称粘贴回去即可。在我的例子中,另一个站点仅监听 IPv6 连接,其根目录位于 /mnt/www。
在我的 TP-LINK TL-WR1043ND 上,默认安装(包括 uhttpd)占用了 4 MiB 多一点的空间,因此网站至少应该有 3.5 MiB 的可用空间。