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

Advertisements

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/application.rb:

config.action_controller.asset_host = "assets%d.example.com"

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, “assets%d.example.com”. If that wildcard is present Rails distributes asset requests among the corresponding four hosts “assets0.example.com”, …, “assets3.example.com”. With this trick browsers will open eight simultaneous connections rather than two.

image_tag("rails.png")
# => <img alt="Rails" src="http://assets0.example.com/assets/rails.png" />
stylesheet_link_tag("application")
# => <link href="http://assets2.example.com/assets/application.css" 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/server.pid 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.

asd