Puppy Webserver with user logins
Puppy Webserver with user logins
I have set up a webserver running Puppy (2.14R) which should make it fairly easy for anybody to setup a home server with a free dynamic DNS service. There are notes on how to set it up, add sshd, ftp, and a firewall.
To quickstart, just goto the download link below, and view the included Readme file. Read on for more detailed info.
Download here
(link updated 16th June 2008):
http://tinytuxbox.co.uk/download/webserver/
I needed the server for file downloads with user logins and restricted areas. A perl script is included which can create user logins, autogenerate passwords, and email them to users.
I rebuilt the latest lighttpd from source and added all the files missing from the current Puppy packages, like config, password file, logs etc. There are comments in the config file and example dummy files packaged in restricted areas for testing. Just untar the webserver package and have a look.
There were several gotchas along the way with running lighttpd from flash media, and running sshd. (See lighttpd.conf and rc.local). The available packages did not work out of the box, I hope this one will.
If you need sshd, you also need the different tinylogin package. The one in 2.14R, and I think still in 3.x, segfaults on password creation. The Tinylogin PET package will not show in the Puppy package manager, but it will install. Run "tinylogin passwd" to create a root password. See the updated rc.local on how to have it all autosetup on boot.
!Important Note!
Be sure to to run the firewall script and only allow http access from outside, and ssh, ftp access from an internal IP -- if you decide to run sshd and ftpd.
The instructions are not yet completely newbie ready, e.g. I did not explain how to set up a static IP or set port forwarding on your router. Actually, you can just use a basic broadband modem, e.g. DSL and connect with pppoe-start in rc.local. Just start the connection *before* the inadyn program for dynamic DNS starts. See the rc.local example.
The various packages are available on the Puppy server itself. All you need to get going are the webserver and inadyn packages, then setup an account at dyndns.org or a similar service. The rest are all advanced option packages for logins, and administration via ssh and ftp.
Let me know how it goes. If it's useful we could consider adding php, mysql, etc.
Marcus
To quickstart, just goto the download link below, and view the included Readme file. Read on for more detailed info.
Download here
(link updated 16th June 2008):
http://tinytuxbox.co.uk/download/webserver/
I needed the server for file downloads with user logins and restricted areas. A perl script is included which can create user logins, autogenerate passwords, and email them to users.
I rebuilt the latest lighttpd from source and added all the files missing from the current Puppy packages, like config, password file, logs etc. There are comments in the config file and example dummy files packaged in restricted areas for testing. Just untar the webserver package and have a look.
There were several gotchas along the way with running lighttpd from flash media, and running sshd. (See lighttpd.conf and rc.local). The available packages did not work out of the box, I hope this one will.
If you need sshd, you also need the different tinylogin package. The one in 2.14R, and I think still in 3.x, segfaults on password creation. The Tinylogin PET package will not show in the Puppy package manager, but it will install. Run "tinylogin passwd" to create a root password. See the updated rc.local on how to have it all autosetup on boot.
!Important Note!
Be sure to to run the firewall script and only allow http access from outside, and ssh, ftp access from an internal IP -- if you decide to run sshd and ftpd.
The instructions are not yet completely newbie ready, e.g. I did not explain how to set up a static IP or set port forwarding on your router. Actually, you can just use a basic broadband modem, e.g. DSL and connect with pppoe-start in rc.local. Just start the connection *before* the inadyn program for dynamic DNS starts. See the rc.local example.
The various packages are available on the Puppy server itself. All you need to get going are the webserver and inadyn packages, then setup an account at dyndns.org or a similar service. The rest are all advanced option packages for logins, and administration via ssh and ftp.
Let me know how it goes. If it's useful we could consider adding php, mysql, etc.
Marcus
Last edited by nibl on Mon 16 Jun 2008, 12:46, edited 3 times in total.
Just wanted to say that I use Puppy for web development and often require a local webserver to test stuff out on CMSs (Drupal, Wordpress, etc). The Webenvironment package is pretty neat, I use it all the time, it's very small at 5MB but doesn't have Sendmail. I've been thinking of updating this package at some point with latest versions of everything and including Sendmail too.
It sounds like what your doing is pretty similar. It'd be great to have a decent and maintained webserver package for Puppy, I know there's already XAMP available but it's so big! I'm really only familiar with the requirements of a local server, therefore not firewalls and security issues -- but a proper websever should be able to function just as well publicly as privately.
It sounds like what your doing is pretty similar. It'd be great to have a decent and maintained webserver package for Puppy, I know there's already XAMP available but it's so big! I'm really only familiar with the requirements of a local server, therefore not firewalls and security issues -- but a proper websever should be able to function just as well publicly as privately.
I used a pure Perl module called Mail::Sender which allowed me to use Perl scripts. It can handle all sorts of attachments too.tombh wrote:The Webenvironment package is pretty neat, I use it all the time, it's very small at 5MB but doesn't have Sendmail.
You could strip Perl down to only what's needed but since everything fits nicely with 2.14R on a 256MB USB stick I didn't see the point. The machine only has 128MB as well, but it's been running 4 days and has served 2.6 GB so far.
The only hiccup was the router not updating dyndns on day 4. That should be easy to fix by running inadyn on the server instead of relying on the router...unless the fault was with the dyndsn service, time will tell.
I thought first of updating the existing one, but apart from not handling mail, working with cut-down versions is difficult because you don't know what the author removed. I always try to keep the defaults if possible, even if it means a few MB more. They are not loaded into RAM and low-cost USB sticks have GBs today, so not really a problem.It sounds like what your doing is pretty similar. It'd be great to have a decent and maintained webserver package for Puppy...
Since this runs well, I am considering adding PHP, and Mysql, because this tiny server responds faster than my professionally hosted ones.
If anybody has any tips on which versions of PHP and Mysql to use, please let me know.
Marcus
Well the latest versions of PHP and MySQL are both in the fives. I'm using Slackware's MySQL package and my own fast-cgi compiled PHP. I too am using a perl mail-sender, but have not managed to integrate with PHP's mail() function -- I have to hack the code with a shell_exec() command. I have experience compiling perl scripts to standalone executables though.
Would you be interested in turning your adventure into a dotpet?
Would you be interested in turning your adventure into a dotpet?
I'm not sure I understand why Perl needs PHP to send mail?tombh wrote:I too am using a perl mail-sender, but have not managed to integrate with PHP's mail() function -- I have to hack the code with a shell_exec() command. I have experience compiling perl scripts to standalone executables though.
The Mail::Sender module (by Jenda K.) is pure perl and requires no other program to send mail, not PHP, not sendmail, or any other binary. The dependencies in the dev_xxx.sfs are all it needs, so just standard Perl. That's why I made a seperate package with full Perl from the dev_xxx.sfs.
No executables needed, that's why I chose it. Jenda has been maintaining the module for years, so that's another good thing.
Try it out, it's very simple to use.
I can turn the webserver into a PET package. tgz2pet does not work, need to create from a directory.Would you be interested in turning your adventure into a dotpet?
I'm not sure whether to add everything to a mega PET though? Does everybody want Perl, and SSH?
Current status is the server has been stable 7 days and served almost 4GB.
The only trouble is with dynamic DNS, it's not 100%. There are intervals when the domain is unreachable because DNS has to update across the networks. I hope that is only once or twice 10-20 mins per day, but's that's a very rough guess.
Marcus
It's more the other way around. You see a lot of Content Management Systems and Web Applications use PHP's built-in mail() function. However, for the mail() function to properly work, the PHP binary needs to have been told about the mail-sending program at compile time. If this hasn't happened then some CMSs will just freeze when they try sending mail! Bummer. I have to go into the code and replace the mail() function with a shell_exec() function. Thus the benefits of a properly compiled PHP binary. I'm sure PHP could be configured to use the Perl mail module.nibl wrote:I'm not sure I understand why Perl needs PHP to send mail?
BTW I use sendEmail, a perl script by Brandon Zehm, sounds very similar to Jenda K's
If a dotpet could potentially be fairly small -- less than 20MB? Then I think it could be worth making a dotpet, but much bigger and it's nearing the realms of XAMP. Your package sounds like it would be more comprehensive than the existing and no longer maintained webenvironment. I think SSH should certainly be a feature of any good webserver setup.
What do you think is causing the dynamic DNS troubles?
Okay, I see. I hadn't thought of CMS sending mail. Potentially, you could trick PHP perhaps?tombh wrote:...for the mail() function to properly work, the PHP binary needs to have been told about the mail-sending program at compile time...I'm sure PHP could be configured to use the Perl mail module.
Symlink sendmail to a perl script which grabs the sendmail params and uses those to send. PHP must be sending params to sendmail right? If so, we could just grab them, pretending to be sendmail. Does that sound feasible?
I can't figure that out at the moment. I switched to router update instead of inadyn, but that's no better. This morning, DNS has been lost again. When I pulled up the router config, it may have caused an update. The domain was back again in 10 minutes or less.What do you think is causing the dynamic DNS troubles?
By chance I had ping running all night and had forgotten to stop it. There was 64% package loss! At some point DNS was lost. It will need some more investigation. I may have to visit some forums to find out others experience with dynamic DNS.
My suspicion is that it's the mandatory interruption of DSL which occurs once in 24hrs, usually in the early morning. After that for some reason it is not updating, but why? Inadyn should notice, even if the router got stuck.
Oh yeah, I'm sure you could 'trick' PHP. A quick look and I see that it's not a compile time option but a PHP.ini option.
That link of Flash's reminds me that MySQL requires users too, webenvironment just defaulted to root. I remember looking at lighttpd's virtualhost setup and had a go but wouldn't know how to extend that to registering new users remotely. Oh yeah and what about a copy of PHPMyAdmin?
64% pacakge loss! So the mandatory interruption causes the update in DNS and for some reason the Name Servers take too long to reflect that. How long should the update take? I can't imagine it's instantaneous even at best?
I bet sendmail and Mail::Sender even share the same arguments.; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
That link of Flash's reminds me that MySQL requires users too, webenvironment just defaulted to root. I remember looking at lighttpd's virtualhost setup and had a go but wouldn't know how to extend that to registering new users remotely. Oh yeah and what about a copy of PHPMyAdmin?
64% pacakge loss! So the mandatory interruption causes the update in DNS and for some reason the Name Servers take too long to reflect that. How long should the update take? I can't imagine it's instantaneous even at best?
Not sure, but maybe the first thing to check is PHP with a contact form. I guess it defaults to sendmail?tombh wrote:I bet sendmail and Mail::Sender even share the same arguments.
There is a PHP 5.x dotpup/PET.
Do you have a simple PHP form handy I could test mailing with?
I don't know PHP much except to tinker with existing code a bit.
Ah yes, that's another one to solve. The improved Tinylogin can handle that though.That link of Flash's reminds me that MySQL requires users too, webenvironment just defaulted to root.
What would virtual hosts be needed for? Won't subdirectories suffice for hosting several CMS together?I remember looking at lighttpd's virtualhost setup
Well, when PHP and Mysql are running then that's probably not so difficult to add. It's actually Mysql which seems a lot of work to me.what about a copy of PHPMyAdmin?
The DNS servers update within 10-20 mins normally using dyndns.org, maybe 30-60 at the outmost.64% pacakge loss! So the mandatory interruption causes the update in DNS and for some reason the Name Servers take too long to reflect that.
I suspect it may be the router is not picking up after the disconnection. One way around that would be a power timer to reboot the router at say 5am, unless it has a timed reboot option in its own config. Haven't checked that.
Here is a php_stuff.tar.gz for you. It contains;
*the php-cgi binary (version 5.2.5)
*php.ini
*Brandon Zehm's sendEmail perl script (N.B. renamed to sendmail)
*PHP scripts to test the mail() function (located at root/www/)
The PHP 5.x dotpet/pup you mentioned is merely for command line use and will not work with Lighty. However, the php-cgi binary I've included was compiled in Puppy 3 so I'm not 100% sure it will work on 2.14R, but I guess 2.14R has a better chance than plain 2.14.
Here is the code needed by lighttpd.conf to enable PHP
Remember to uncomment "mod_fastcgi" in the server.modules array aswell.
Note that I'm using php-cgi with Fast CGI enabled, this is not essential, it's just the way webenv was setup and so the way I've done things.
If you do try and compile PHP yourself the minimum configure options would simply be --
You might also like to try Slackware's MySQL tarball, it works perfectly in Puppy 3.
Not that I'm that experienced but it would be possible that if you have difficulties adding PHP and MySQL then you could send me the dotpet and I could see what I could do.
The one gotcha I encountered was PHP's refusal to look to any other MySQL socket other than /var/run/mysql/mysql.sock so I just ended up changing the socket name through MySQL in my.cnf
*the php-cgi binary (version 5.2.5)
*php.ini
*Brandon Zehm's sendEmail perl script (N.B. renamed to sendmail)
*PHP scripts to test the mail() function (located at root/www/)
The PHP 5.x dotpet/pup you mentioned is merely for command line use and will not work with Lighty. However, the php-cgi binary I've included was compiled in Puppy 3 so I'm not 100% sure it will work on 2.14R, but I guess 2.14R has a better chance than plain 2.14.
Here is the code needed by lighttpd.conf to enable PHP
Code: Select all
fastcgi.server = ( ".php" =>
(( "socket" => "/tmp/php-fastcgi.socket",
"bin-path" => "/usr/local/bin/php",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "1",
"PHP_FCGI_MAX_REQUESTS" => "1000" ),
"bin-copy-environment" => (
"PATH", "SHELL", "USER" ),
"broken-scriptfilename" => "enable"
))
)
Note that I'm using php-cgi with Fast CGI enabled, this is not essential, it's just the way webenv was setup and so the way I've done things.
If you do try and compile PHP yourself the minimum configure options would simply be --
Code: Select all
--enable-fastcgi --with-mysql
Not that I'm that experienced but it would be possible that if you have difficulties adding PHP and MySQL then you could send me the dotpet and I could see what I could do.
The one gotcha I encountered was PHP's refusal to look to any other MySQL socket other than /var/run/mysql/mysql.sock so I just ended up changing the socket name through MySQL in my.cnf
Why are you having dynDNS problems? I've served a number of vhosts since 2003 on an ADSL2+ connection and and the updater works within seconds of the connection being dropped which may happen perhaps once or twice a month at the most in my situation.nibl wrote:Current status is the server has been stable 7 days and served almost 4GB.
The only trouble is with dynamic DNS, it's not 100%. There are intervals when the domain is unreachable because DNS has to update across the networks. I hope that is only once or twice 10-20 mins per day, but's that's a very rough guess.
Marcus
Perhaps you have a problem with your ISP, or a physical problem with DSLAM configuration at the phone exchange?
Richard
[i]Have you noticed editing is always needed for the inevitable typos that weren't there when you hit the "post" button?[/i]
[img]http://micro-hard.dreamhosters.com/416434.png[/img]
[img]http://micro-hard.dreamhosters.com/416434.png[/img]