Archive

Posts Tagged ‘lighttpd’

debian 4 web server setup

November 7th, 2008

First post in awhile! I just had to get that out there. Well it has been an intense couple of weeks with college life really starting to kick in (the tests and lectures) and my work being the way it has. But I am back serving up cookbook recipies. Today’s is about setting up a debian based web server (for those of you with a vps or dedicated box). It is assumed that you are able to send mail directly from this box. Enjoy.

1) Install debian from floppies, full cd, or cd net install. Pretty self explanitory. I suggest doing it from floppies or cd net install, because we want to save as much disk space as possible for data.

2) Log in as root and run:

  • apt-get update
  • apt-get upgrade

If the system prompts you to reboot a process or the system, do as it says. Once you reboot all the core daemons and programs should be the latest (stable) versions.

3) Install the ssh server [apt-get install ssh] for remote command line access, so you don't have to be hunched over a server rack.

4) If you wish to have email functionality follow the instructions in this article on howtoforge.org.

5) various dependencies and apps (php, mysql, pcre for nginx): apt-get install php5-cli php5-cgi build-essential mysql-server mysql-client openssl libssl-dev libpcre3 libpcre3-dev bzip2 gzip
better lock down the mysql root user: mysqladmin -u root password NEWPASSWORD

6) For individual virtual host files under nginx:
mkdir /etc/nginx
mkdir /etc/nginx/sites-enabled

[Sample Virtual Host File] • [More on Virtual Hosts]

7) if ($operating_system == “ubuntu*”) {
grab the nginx .deb archive (check the other releases out on technokracy.net):
[i386] wget http://www.lizardking.biz/wp-content/uploads/2008/11/nginx_0613grrr-1_i386.deb
OR
[amd64] wget http://www.lizardking.biz/wp-content/uploads/2008/11/nginx_0613grrr-1_amd64.deb
unpack and setup nginx: dpkg -i nginx_*
}else if($operating_system == “debian*”){
command to grab nginx: apt-get install nginx
}

8) Setup lighttpd for spwan-fcgi
grab the archive and make it. but DO NOT make install!
wget http://www.lighttpd.net/download/lighttpd-1.4.20.tar.bz2
tar -xvjf lighttpd-*
cd lighttpd*
./configure --without-bzip2
make

Now copy what we need for spawn-fcgi: cp src/spawn-fcgi /usr/bin/spawn-fcgi
Open the config file: vi /usr/bin/php-fastcgi
And add: /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -u www-data -f /usr/bin/php5-cgi
-C controls how many fcgi instances of PHP5 are spawned, so you can put however many are appropriate for you in there. I only needed 5.

Open the startup file: vi /etc/init.d/init-fastcgi
Add the following:
#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
RETVAL=0
case "$1" in
start)
$PHP_SCRIPT
RETVAL=$?
;;
stop)
killall -9 php
RETVAL=$?
;;
restart)
killall -9 php
$PHP_SCRIPT
RETVAL=$?
;;
*)
echo "Usage: php-fastcgi {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL

Now change some perms to make the files executable:
chmod 755 /etc/init.d/init-fastcgi
chmod 755 /usr/bin/php-fastcgi

Start your fcgi processes: /etc/init.d/init-fastcgi start
And add the script to startup: update-rc.d init-fastcgi defaults
Restart nginx and see if it works: /etc/init.d/nginx restart

#8 was based on: http://www.johnyerhot.com/2008/02/12/how-to-nginx-fcgi-php-mysql-ruby-on-rails-rewrite-vhosts/

[More on fcgi setups on the nginx wiki]

9) Install vsftpd
apt-get install vsftpd
Now open up the configuration file: vi /etc/vsftpd.conf
I am creating a single/few user system here, so whenever I add a new user, that user will have ftp permissions. Which would mean that I would edit the config file so that: local_enable=yes and chroot_local_user=YES.
Restart vsftpd: /etc/init.d/vsftpd restart

10) A great resource page on adding, editing, and deleting users can be found at http://www.ahinc.com/linux101/users.htm.

Linux, Server , , , ,

state of the network

July 1st, 2008

What’s new with lizardking.biz:

  • Snapshots: a tool on this site (and others) provided by Snap.com that enhances links with visual previews of the destination site, interactive excerpts of Wikipedia articles, MySpace profiles, IMDb profiles and Amazon products, display inline videos, RSS, MP3s, photos, stock charts and more. If you don’t want the Snapshots, just click the Options icon in the upper right corner of the Snap Shot and opt-out.
  • WidgetBucks: they create contextual ad widgets that you can customize for your visitors, so they actually click. Allegedly the PPC ad widgets are doing $3-$6 CPM.

The reformation of vraid.ws:

And vraidsys.com:

Your Ad Here

Internet, Money, Server, Software , , ,