Monthly Archives: January 2009

Funny AXE Ad ( or fake ad )

0
Filed under Humor

axe

FedEx + Bad Weather == Woot Package Delayed

0
Filed under Tech, Weather

I just checked the status of my woot shipment and it turns out Fedex has pushed the delivery date to Feburary 3rd. The ice storm down south must have caused the delay, as its not to bad in Buffalo.

jan-28-09-snow

Random picture from the rings webcam

0
Filed under Cars

I haven’t seen activity in a while, I wonder what they are fixing…

Work being done at the Ring

Work being done at the Ring

Woot HD Camcorder

0
Filed under Video

I have been tossing around the idea of getting a HD camcorder to record my races since the summer. The cost of entering the HD realm was a few hundred dollars, and I was iffy about spending the money. Today Chris pointed me at Woot, they had a decent HD camcorder for $129. Even if its not the best camcorder its a great entrance point into my own HD camcorder. Hopefully next week I will post some test video and unboxing pictures.

Check it out @ Woot

Ubuntu xcache

1
Filed under Linux, Servers

If you need to setup xcache for use in your nginx + php5 setup this tutorials will show you how.

Installation

  1. Update apt:
    sudo apt-get update
  2. Install xcache:
    sudo apt-get install php5-xcache

Configuration of xcache

  1. Edit the xcache config file:
    sudo vim /etc/php5/conf.d/xcache.ini

    and update the values for

    • xcache.size (set to desired memory size)
    • xcache.var_size (set to desired memory size)
    • xcache.cacher (set to On)
    • xcache.optimizer (set to On)

    If you don’t want admin access then set
    xcache.admin.auth = Off

Finishing Up

  1. Now that the configuration is complete we need to restart php:
    sudo /etc/init.d/init-fastcgi stop
    sudo /etc/init.d/init-fastcgi start
  2. Enjoy your xcached php goodness…

Great Zed Shaw Talk

0
Filed under Talks, Tech

I stumbled across a talk by Zed Shaw at a conference that I thought I would share. After watching the talk I agree with a large percentage of what he has to say. Actually I can’t think of anything I didn’t agree with, and his discussion about corp coding and home coding was spot on. That is a topic that I need to work on…

Zed Shaw – The ACL is Dead

Ubuntu Nginx and PHP5

2
Filed under Linux, Servers

This post will go over the steps you need to get nginx running with php5. I am going to use a list to show the steps to take, please leave a comment if you see something that needs to be corrected or just want to leave feedback.

Installation

  1. Update apt:
    sudo apt-get update

  2. Install nginx:
    sudo apt-get install nginx


  3. Install php-cgi for use with mysql:
    sudo apt-get install php5-cgi php5-mysql


  4. We need a binary that comes with lighttpd to launch the php5 cgi:
    sudo apt-get install lighttpd


  5. Now remove lighttpd from startup since we will be using nginx:
    sudo update-rc.d -f lighttpd remove

Configuration of nginx,startup scripts,fastcgi

  1. Create a bash script that will spawn the php fcgi handlers:
    sudo vim /usr/bin/php-fastcgi


  2. and enter the following:

    #!/bin/bash
    /usr/bin/spawn-fcgi -a 127.0.0.1 -p 10005 -u www-data -g www-data -f /usr/bin/php-cgi

    Make sure to set www-data to the user and group that you want php running as.

  3. Make the script executable:
    sudo chmod +x /usr/bin/php-fastcgi


  4. Now lets at create an init script that will execute the above script on boot (this script is from a blog that I can’t remember the name of):
    sudo vim /etc/init.d/init-fastcgi

    and enter the following

    #!/bin/bash
    PHP_SCRIPT=/usr/bin/php-fastcgi
    RETVAL=0
    case "$1" in
    start)
    $PHP_SCRIPT
    RETVAL=$?
    ;;
    stop)
    killall -9 php-cgi
    RETVAL=$?
    ;;
    restart)
    killall -9 php-cgi
    $PHP_SCRIPT
    RETVAL=$?
    ;;
    *)
    echo "Usage: php-fastcgi {start|stop|restart}"
    exit 1
    ;;
    esac
    exit $RETVAL


  5. Make the script executable:
    sudo chmod +x /etc/init.d/init-fastcgi


  6. Add the script to run at bootup:
    sudo update-rc.d init-fastcgi defaults


  7. Now we will begin configuring nginx to proxy php request. First we need to setup a include file that will hold some fastcgi_param’s.
    sudo vim /etc/nginx/fastcgi.conf

    and enter

    #fastcgi.conf
    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    #To use Nginx + Virtual Host + PHP you should ommit the SCRIPT_NAME
    #variable in order for PHP to choose the correct DOCUMENT_ROOT
    #fastcgi_param SCRIPT_NAME $fastcgi_script_name;

    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;
    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    #fastcgi_param REDIRECT_STATUS 200;


  8. Edit the server conf and tell it where to proxy requests to:
    sudo vim /etc/nginx/sites-enabled/default


  9. In the server section add the following:

    location ~ .*\.php$ {
    include /etc/nginx/fastcgi.conf;
    fastcgi_pass 127.0.0.1:10005;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /home/xxx/public_html/domian/public/$fastcgi_script_name;
    }

    *Update SCRIPT_FILENAME to point to your doc root*

  10. Update index list to enable index.php: *Thanks Brian*

    index index.html index.htm index.php;


  11. Restart nginx and start the php cgi handlers:

    sudo /etc/init.d/nginx restart
    sudo /etc/init.d/init-fastcgi start