Posts

Showing posts from March, 2013

Nginx Crumbs - Rewrite vs Return

More often than not there are times when your initial thought process changes mid way through your production ready application and you decide to change your application url. It could be your scheme (from a non-www to a www or vice-versa) or it could be your protocol (say, from http to https). There are two ways of implementing this change in nginx. ## Redirect from non-www to www  server {   server_name example.com;   # Option 1    return 301 $scheme://$host$request_uri;   # Option 2   rewrite ^ http://$host$request_uri? permanent;  } ## Redirect from http to https  server {   server_name example.com;   # Option 1    return 301 https://$server_name$request_uri;   # Option 2   rewrite ^ https://$server_name$request_uri? permanent;  } REWRITE Only the part of the original url that matches the regex is rewritten. Slower than a Return. Returns HTTP 302 (Moved Temporarily) in all cases, ir...

AWS VPC - Basic Set Up

This blog is a collection of notes that were taken while settings up a virtual private cloud in AWS. The scenario presented here is described as below A chef server for configuration management. Jenkins CI server. Knife plugins to create and deploy application artifact. Load Balanced Web servers. DB servers. The AWS VPC scenario is Scenario 2 .   Most of the basic setup is mentioned in the article above. The basic parts of this setup are as follows PUBLIC NETWORK This network is exposed to the internet. Each node set up in the public network can talk to the internet (outbound). For inbound traffic, each node needs to be associated with an Elastic IP. Each node should have the Ephemeral Ports open since ACLs are stateless. Ephemeral ports are ports opened on the client end when the client machine tries to connect to a server machine on a specific port. PRIVATE NETWORK This network is a protected network. Mostly used to host back-end servers like databas...