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.
- First of all you have to start your board and login to Root-Filesystem
- Mount the filesystem read-writeable
- mount -o remount,rw /
- Create a folder with any name in any directory
- mkdir /www
- Copy your html file to your directory
- cp index.html /www
- Activate the networkadapter
- udhcpc
- Now you can start the webserver
- httpd -h /www
- 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
- In our default configuration php is disabled, so first of all we have to enable php support
- Navigate to buildroot folder
- 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
- Save and close menuconfig
- recompile Root-Filesystem
- make
- After that install the new Root-Filesystem and start the board
- 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
- 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";"
- 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