Web Server (Linux)
There are many options of ready-to-use web servers for Linux, as well as frameworks and libraries for setting-up a web server integrated to your own application, each one of them with its own pros and cons. Please choose the one that best suit your needs.
Prerequisitesβ
Most of the solutions provided in this page, if not all of them, assume you have a working OpenEmbedded build environment setup. If you don't, please go though the OpenEmbedded (core) article:
Make sure you are able to build and deploy the reference image from the Building section provided by Toradex before proceeding.
Ready-to-use Web Serversβ
This section goes though the setup of popular ready-to-use webservers, which are often broad and reliable solutions adopted worldwide in server environments. Some of them may not be optimal choices for embedded systems since they were originally designed for high-capacity servers.
Lighttpdβ
Lighttpd has a recipe in the openembedded-core layer, which is already included in the Toradex embedded Linux BSP.
Add the following line to the end of the conf/local.conf
file:
IMAGE_INSTALL_append = " lighttpd"
To configure Lighttpd please refer to the Lighttpd documentation.
Nginxβ
Nginx can be installed using OpenEmbedded similar to Lighttpd, please refer to the Lighttpd section for setup instructions. It has a recipe in the meta-webserver layer, which is already included in the Toradex embedded Linux BSP.
Add the following line to the end of the conf/local.conf
file:
IMAGE_INSTALL_append = " nginx"
To configure Nginx please refer to the Nginx documentation.
Apache2β
Apache2 can be installed using OpenEmbedded similar to Lighttpd, please refer to the Lighttpd section for setup instructions. It has a recipe in the meta-webserver layer, which is already included in the Toradex embedded Linux BSP.
Add the following line to the end of the conf/local.conf
file:
IMAGE_INSTALL_append = " apache2"
To setup please refer to the Apache2 documentation.
Frameworks for Creating a Web Serverβ
Most of the popular programming languages have at least one framework for setting-up a web server inside your application. This may be well suited for embedded applications since you have control over the implementation, with the trade-off that if you don't plan carefully, it may be less reliable or present worse performance than a ready-to-use webserver.
Node.js + Expressβ
The use of Node.js + the Express framework to create web servers, along MongoDB and Angular has originated the acronym MEAN a.k.a. MEAN stack.
Arm 32-bit platforms are no longer supported by MongoDB since version 3.4. You can still use Node.js and Express, since they are independent of MongoDB.
Please refer to the Node.js in Linux article for instructions how to setup Node.js and the NPM package manager on the target system. After you have them, you can use NPM to install Express as described in the project documentation:
cd my-project-dir
npm install express
Make sure to refer to the Express website for documentation.
Python + Flaskβ
Flask is one of the most popular frameworks to build web server applications in Python. There are OpenEmbedded recipes for Flask both for Python 2 and Python 3.
Add the following line to the end of the conf/local.conf
file:
# Python 2
IMAGE_INSTALL_append = " python-flask"
# Python 3
IMAGE_INSTALL_append = " python3-flask"
Additional Python packages required by your application may have to be included as well. Please refer to the Python in Linux article for instructions how to setup Python and other dependencies that may be required.
Make sure to refer to the Flask documentation for reference.