Running Web server with PHP on iMX233-OLinuXino-MAXI


Image

Here are the steps to run your own embedded web server with iMX233-OLinuXino-MAXI.

We assume you use ARCH Linux distribution:

1. Using pacman download the following packages:

lighttpd

# pacman -Sy lighttpd

mod_fastcgi

# pacman -Sy mod_fastcgi

php-cgi

# pacman -Sy php-cgi

2. Edit the lighttpd.conf file

#vi /etc/lighttpd/lighttpd.conf

NOTE: if you can’t find this file reboot the board and try again..

The file should look something like this

# This is a minimal example config
# See /usr/share/doc/lighttpd
# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions

server.port = 80
server.username = “http”
server.groupname = “http”
server.document-root = “/srv/http”
server.modules = (
“mod_access”,
“mod_fastcgi”,
“mod_accesslog”)
server.errorlog = “/var/log/lighttpd/error.log”
dir-listing.activate = “enable”

fastcgi.server = ( “.php” => ((
“bin-path” => “/usr/bin/php-cgi”,
“socket” => “/tmp/php.socket”
)))
index-file.names = ( “index.html” )
mimetype.assign = ( “.html” => “text/html”, “.htm” => “text/html”, “.txt” => “text/plain”, “.jpg” => “image/jpeg”, “.png” => “image/png”, “” => “application/octet-stream” )

Save and exit the editor. You can check the syntax with the command:

# lighttpd -t -f /etc/lighttpd/lighttpd.conf

With this configuration you should have working web-server at port 80 and implemented php

3. Reboot the board.

4. After the restart load the configuration file and start the daemon:

# lighhtpd -f /etc/lighttpd/lighttpd.conf

# /etc/rc.d/lighttpd start

You can see which daemons are started with the command:

# rc.d list

If you want to add this to autostart modify /etc/rc.conf and add lighttpd to DAEMONS array:

DAEMONS=(set-olinuxino-mac !hwclock syslog-ng network netfs crond sshd lighttpd)

5. Test the server

Now just open any browser and type the IP of the OlinuXino board and you should see “Hello” message. The folder containing the index.html is /srv/http. Just put your webpages there and your good to go.

4 Comments (+add yours?)

  1. Trackback: WEB-IO control of iMX233-OLinuXino-MAXI GPIOs from web « olimex
  2. Rolf Lehmann
    Nov 15, 2012 @ 14:01:37

    Excellent !!!
    That is exacly what we need :-))

    Reply

  3. Rumen
    Apr 25, 2013 @ 12:54:08

    All was OK till step 3. After reboot I can not reach the Arch Linux through ssh.After that I connect monitor and keyboard to the olinuxino board, but cannot write through keyboard (connected on USB port). On the screen have Linux 2.6.35-8-ARCH (ttg1) and Logon:
    But I cannot write the user and password, because keyboard is not recognized, Unfortunately the Ethernet port also not working.
    What are possible decisions?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: