• Servir una web alternativa en OpenWrt

    Si queremos que OpenWrt sirva una web en el mismo puerto 80 (o 443) que la interfaz LUCI, pero sin interferir con la propia interfaz, podemos hacerlo agregando un virtualhost a uhttpd. Esto lo podemos hacer de la siguiente manera:

    1 – Creamos la carpeta y el archivo para la web:

    mkdir -p /www/webalternativa
    echo "<h1>Web alternativa</h1>" > /www/webalternativa/index.html

    2 – Agregamos el virtualhost directamente con uci:

    cp /etc/config/uhttpd /etc/config/uhttpd.bak
    uci add uhttpd alias
    uci set uhttpd.@alias[-1].alias='/webalternativa'
    uci set uhttpd.@alias[-1].target='/www/webalternativa'
    uci commit uhttpd
    /etc/init.d/uhttpd restart

    Estos cambios realizados con UCI se traducen en haber agregado las siguientes lineas:

    config alias
      option alias '/webalternativa'
      option target '/www/webalternativa'

    …al archivo /etc/config/uhttpd.

    Como vemos, es un hack súper fácil y súper rápido.


    Deja una respuesta