Month: March 2012

  • Configure nginx to log the virtual host

    Nginx does not have the concept of virtual host like Apache does — nginx refers to the apache virtual host as the server. To log the requested host with each request, which makes troubleshooting when multiple sites are hosted on the same instance much easier, use the following format: log_format main ‘$remote_addr $host $remote_user [$time_local] […]

  • MySQL Load Data Infile – Epoch time to Timestamp

    I was recently working on a data load where I wanted to convert one column from an epoch time format into a timestamp column on import. I couldn’t figure out why the timestamp was being set to the current time on every test, no matter what I set the variables/values to. I initially tried with […]

  • Proxy HTTP Requests through Nginx to Jetty6 with X-Forwarded-For

    One important part of any proxy configuration is logging the correct originating IP address on the final application log to ensure proper analytics and problem determination. Note that at times, it’s very useful to log the proxy or load balancer IP at the application server to determine where an issue may be occurring but for […]

  • Rewrite HTTP requests to HTTPS using Nginx

    A common task is to rewrite HTTP requests to HTTPS to secure communication. Using nginx, this is easily done with: # use only https if ($scheme = http) { rewrite ^ https://$host$uri permanent; } This should be placed in a server block.

  • Compiling USB to Serial Kernel Modules on the D2Plug

    I recently ordered a GlobalScale D2Plug (makers of the SheevaPlug) and needed to be able to hook up a serial device via USB. The only problem was that the installed kernel did not have the proper modules available, namely pl2303 and ftdi_sio. Although this unit was shipped running Ubuntu 10.04, performing software updates via aptitude […]

  • Splitting Backups into 5GB Chunks

    A common problem with cloud storage of files is that many restrict the filesize to make things more manageable. A good way to solve this problem is to use split to reduce the filesize and create multiple smaller files from a large archive. There are two primary use cases – note that these commands split […]