Set up NginX + Thin + Rails on EC2

I’ve worked this out today, and it’s an enjoyable long process started from yesterday.

Here is a general description of what I’ve done.
1. Register for EC2.

2. Started an instance on EC2, and create a security group which allows instance listen to port 22(ssh) and 80(http).

3. Generate a elastic IP on EC2.

4. Install NginX, Ruby on Rails, Thin on my instance.

5. Configure Thin and Nginx .

6. Launch!

There’re several tips I learned from this installation process.

  1.  You need to put your rails app folder under /var/yourapp in order to get read authority.
  2.  You don’t have to stop Nginx to reload your configuration, just type: nginx -s reload.
  3.  When you trying to stop thin server, you should use this command: thin -C /etc/thin/yourapp.yml stop.

Moreover, it’s very important for you to remember some useful shell command on Linux, such as nano(text editor), ps -ef | grep -i nginx (show if the specified instance is running), cat, and so forth.

The server’s running well, but I’m still a little concern with the safety configuration of my server. And I put NginX configuration on /etc/nginx/nginx.conf. I think it’s not a standard way, but in order to speed up I’ve to choose a simpler method.

So, that’s all, hope you can get something useful from this post.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s