Author: Josh
-
AWS Elastic Load Balancing in a Private Subnet
I recently learned a valuable lesson when setting up load balancing using an Elastic Load Balancer within a Virtual Private Cloud using public and private subnets and a NAT host. When creating the ELB, be sure to create it within the public subnets and not the private subnets where the instances that will be attached…
-
nginx passenger module re-install
I logged in this morning and one of my clients had an issue with a Passenger app that was not responding and nginx was returning 403s for requests to the app. I dug into the nginx error.log and it showed that it could not find the PassengerWatchdog file that it would use to start the…
-
Print only uncommented lines from a text file
A common task that I perform is to print out the lines of a text file (or script) that are not commented and no blank lines. A few good examples of where this would be useful would be the apache httpd.conf file (which has verbose comments!) and a hosts file where many entries are in…
-
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…
-
Proxy Requests to Splunk with Apache 2.2
When installing Splunk on a server with existing applications and Apache already setup and running, it’s easy to add support for Splunk via mod_proxy. Although I believe it’s best to use virtual hosts to split out applications and setup proper DNS, in this example, I will be using the default virtual host (or none at…