Example usage of BusyBox httpd webserver

  • How to use httpd webserver from BusyBox?


    In this post I will show you an example how you can activate and use the httpd webserver from BusyBox.


    1. First of all you have to start your board and login to Root-Filesystem
    2. Mount the filesystem read-writeable
      • mount -o remount,rw /
    3. Create a folder with any name in any directory
      • mkdir /www
    4. Copy your html file to your directory
      • cp index.html /www
    5. Activate the networkadapter
      • udhcpc
    6. Now you can start the webserver
      • httpd -h /www
    7. After that you can go to your development machine, start your browser and connect to the board
      • 192.168.0.1/index.html


    If you need PHP support you need additional settings. The necessary information can also be found on the following homepage:

    https://box.matto.nl/busyboxphp.html


    1. In our default configuration php is disabled, so first of all we have to enable php support
      1. Navigate to buildroot folder
      2. call make menuconfig and activate the following packages:
        • Target packages / Interpreter language and scripting / php
        • Target packages / Interpreter language and scripting / php / CGI interface
        • Target packages / Interpreter language and scripting / php / CLI interface
      3. Save and close menuconfig
      4. recompile Root-Filesystem
        • make
    2. After that install the new Root-Filesystem and start the board
    3. Create file httpd.conf in /etc directory. The file need the following line "*.php:/usr/bin/php-cgi"
      • echo *.php:/usr/bin/php-cgi > /etc/httpd.conf
    4. Modify file /etc/php.ini
      • Search after the following line ";cgi.force_redirect = 1" and modify it to "cgi.force_redirect = 0"
      • Search after the following line ";cgi.redirect_status_env = " and modify it to "cgi.redirect_status_env = "yes";"
    5. After that you can repeat the steps 1-7 above


    In attachment you will find an example file index.html for html and an example file index.php for php support. The files are zipped.



    Your F&S Support Team

    Files

    • index.zip

      (1.22 kB, downloaded 937 times, last: )

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

    Edited 2 times, last by fs-support_PJ ().