Nginx : Configuration : Serving Static contents ( Images / Static HTML / Assets )

This page is continuity of my last post Linux Distributions : Nginx : Configuration Basics

After you install Nginx inside the folder  /etc/nginx/ you can see the file nginx.conf which has a working configuration and some commented directives. Don’t change anything if you are beginner.

Continue reading

Amazon S3 : Carrier Wave : Error : The difference between the request time and the current time is too large.

Error:  Excon::Errors::Forbidden

You have sometime faced this error which you can see in the server log in development or any environment. This mainly concerns with Amazon S3 server or any other servers you rely upon for APIs.

Main Reason:

  • You have changed your system Date – Time by any means
  • You use Virtual Machine to run your operating system in which your development environment run and you have resumed the system from suspension after a while.
  • Your server Date – Time is not configured properly if you have your own server locally (Physically)

Continue reading

Ruby On Rails: Deploy on Engineyard server

Platform as a service (PaaS) is a category of cloud computing services that provides a platform allowing customers to develop, run and manage Web applications without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app.[1]

Features of Engineyard PaaS[2]

Managed Application Runtime

Continue reading

Ruby On rails : Distribute asset load to multiple asset host


config.action_controller.asset_host = ""

Browsers typically open at most two simultaneous connections to a single host, which means your assets often have to wait for other assets to finish downloading. You can alleviate this by using a %d wildcard in the asset_host. For example, “”. If that wildcard is present Rails distributes asset requests among the corresponding four hosts “”, …, “”. With this trick browsers will open eight simultaneous connections rather than two.

# => <img alt="Rails" src="" />
# => <link href="" media="screen" rel="stylesheet" />

Forcefully kill WEBrick instance in Ubuntu and Windows

For Linux/Ubuntu Users, ubuntu has kill command. While running webrick server, in project directory within location APP_DIR/tmp/pids/ there will be all Process Ids saved.
You just need to open the file, you will find the Process Id of currently running server. Now you can use the following command to kill the process

$ kill [pid] # Example kill 8123

For Windows user, you can use the following command

taskkill /PID 8436

Rails detects changes in Models, Views and Controllers aut

When does server restart?

Server restarts if browser requests for fresh content. In normal request the Application is not reloaded in fact the older version of app is rendered  and sent to client.

To get latest version you need to reload removing cache. You need to Hard-Reload the Browser.

In development mode (which is what you're working in by default), Rails reloads your application with every browser request, so there's no need to stop and restart the web server when a change is made.


jQuery :: AJAX request return 200 OK but error event is fired instead of success

  • The main thing is, if data is not properly formatted in expected format
    such as JSON then parse_error is triggered. So your success block is not 
    In fact null should also be wrapper properly in {}
  • dataType (default: Intelligent Guess (xml, json, script, or html))
    Type: String
    The type of data that you’re expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string).
  • "json": Evaluates the response as JSON and returns a JavaScript object.
  • The JSON data is parsed in a strict manner;
  • any malformed JSON is rejected and a parse error is thrown
  • error
    Type: Function( jqXHR jqXHR, String textStatus, String errorThrown )
    A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as “Not Found” or “Internal Server Error.” As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.