WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql  (Read 20467 times)

Offline m23402027

  • Newbie
  • *
  • Posts: 7
    • LED
[REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« on: August 04, 2011, 09:22:54 PM »
Hi everyone,
I am new in this tinycore/microcore distribution. My system is Dell Mini 9 (no internal SSD - broken), so I installed tinycore iso image to USB using Universal USB Installer, and it is confirmed that persistence is enabled.

Right now I am trying to setup a web server that uses Lighttpd, PHP, and MySQL. In UBUNTU distros this was a real piece of cake but I am completely lost in Tinycore.
Using Apps I selected and installed each packages one by one, and it is confirmed that installation was done successfully.

The problem is I don't know how to start this web server successfully, I know it is lame, many search results in this forum says lighttpd -D -f lighttpd.conf, I can not find lighttpd.conf, referring to the original documentation in http://redmine.lighttpd.net also does not point to successful setup as I believe the working directories mentioned in http://redmine.lighttpd.net are completely different in TinyCore system.

Can anyone tell me a great step to install this web server and configure it to run each time at startup, because I can not find any thread that explicitly tells command by command to setup this simple kind web server, Please?

Thanks everyone.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11632
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #1 on: August 04, 2011, 09:45:53 PM »
Hi m23402027
Run AppBrowser and read the comments on the Info tab for lighttpd.tcz. It gives an example for
setting up the config file.

Offline m23402027

  • Newbie
  • *
  • Posts: 7
    • LED
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #2 on: August 05, 2011, 02:10:25 AM »
Thanks for replying Rich.

In the info section there is this comment:

Code: [Select]
Example chroot script:
HTTPD=/usr/local/sbin/lighttpd
HTTPD_ROOT=/www
HTTPD_CONF=$HTTPD_ROOT/lighttpd.conf
cat << EOF > $HTTPD_CONF
server.document-root = "/htdocs"
server.port = 80
server.username = "nobody"
server.groupname = "nogroup"
server.chroot = "$HTTPD_ROOT"
EOF
exec $HTTPD -D -f $HTTPD_CONF

In the last line I see the script executed $HTTPD which is the lighttpd binary itself, with configuration file defined in $HTTP_CONF simply at /www/lighttpd.conf. What I don't understand is the corresponding folder /www or even /www/lighttpd.conf file doesn't exist in the default installation, even after installing lighttpd.tcz.

Back again then, what should I do to make this work? the info itself doesn't say pretty much.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11632
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #3 on: August 05, 2011, 02:26:42 AM »
Hi m23402027
I'm not familiar with these particular packages, but based on the info section I suspect it does not
come with a default  lighttpd.conf  file. I could be wrong, but it looks like you are supposed to
create a  /www  directory.

Offline m23402027

  • Newbie
  • *
  • Posts: 7
    • LED
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #4 on: August 05, 2011, 02:38:48 AM »
Yes, sir. I agree with you. I guess I must setup the whole working enviroment directory and download all those original *.conf files from http://redmine.lighttpd.net. I will give it a try first and report here if there are any progress. Maybe made some little walkthrough...
« Last Edit: August 05, 2011, 03:00:35 AM by m23402027 »

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #5 on: August 05, 2011, 10:36:47 AM »
Here is the script I use to create my lighttpd.conf and start it up. I do both at once to simplify the example. You will only need to create the lighttpd.conf once if you store it on persistent media.

# Start Lighttpd
HTTPD=/usr/local/sbin/lighttpd
HTTPD_ROOT=/mnt/hda1/www
HTTPD_CONF=$HTTPD_ROOT/lighttpd.conf
cat << EOF > $HTTPD_CONF
mimetype.assign = (".html" => "text/html")
server.document-root = "/htdocs"
server.port = 80
server.username = "nobody"
server.groupname = "nogroup"
server.chroot = "$HTTPD_ROOT"
EOF
exec $HTTPD -f $HTTPD_CONF &>/dev/null

My /mnt/hda1/www/htdocs directory contains my web root with index.html, etc. Note that you don't have to run lighttpd in a chroot, but I do it because it is so simple. Let me know if you need more assistance.
« Last Edit: August 05, 2011, 10:41:19 AM by danielibarnes »

Offline m23402027

  • Newbie
  • *
  • Posts: 7
    • LED
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #6 on: August 08, 2011, 02:38:04 AM »
Hi Daniel, if made it! your script worked on the fly. Now I am stuck in PHP. How to make Lighttpd and PHP plays nice each other? because whenever I open a php link in my browser it tries to download the php file, i mean the server not parsing those php files

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #7 on: August 08, 2011, 02:49:43 AM »
Try adding ".php" => "application/x-httpd-php" within mimetype.assign:

mimetype.assign = (".html" => "text/html", ".php" => "application/x-httpd-php")

Offline m23402027

  • Newbie
  • *
  • Posts: 7
    • LED
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #8 on: August 08, 2011, 03:02:46 AM »
Thanks for fast response.
I tried adding that, but still cannot. Is this has something to do with mod_fastcgi?

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #9 on: August 08, 2011, 04:43:15 AM »
I've not used it with PHP, so I can't answer for certain. I know several here have, though, and maybe one of them can give details.

Offline m23402027

  • Newbie
  • *
  • Posts: 7
    • LED
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #10 on: August 08, 2011, 05:28:00 AM »
That's fine. LOL now I'm trying Apache modules, see how it is gonna work.

Offline robc

  • Sr. Member
  • ****
  • Posts: 447
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #11 on: August 08, 2011, 03:22:36 PM »
the php5 info file says how to setup php-cgi with lighttpd

Edit: Here is a link to a post with a ligthttpd config for php that I used to use: http://forum.tinycorelinux.net/index.php?topic=4892.msg25796#msg25796
« Last Edit: August 08, 2011, 03:24:48 PM by robc »
"Never give up! Never surrender!" - Commander Peter Quincy Taggart

"Make it so." - Captain Picard

Offline m23402027

  • Newbie
  • *
  • Posts: 7
    • LED
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #12 on: August 10, 2011, 07:30:15 AM »
Thanks Robc!. Great! i'm gonna try it.

Offline Pats

  • Sr. Member
  • ****
  • Posts: 322
Re: [REQ] How To Setup Web Server using Lighttpd, PHP, MySql
« Reply #13 on: August 29, 2011, 02:24:53 PM »
LOL ! I was also lost seting-up Lighttpd, php etc.
Ultimately I setup Apache,PHP,mySQL on Knoppix distro. Am still using Knoppix for my webserver testing needs.
But I will like using Apache,mySQL etc in TCL, though !

~Pats