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.
- Install Nginx on EC2: http://kdn2.info/2011/05/install-nginx-on-amazon-ec2/
-
How to install thin and Nginx on EC2: http://equivalence.co.uk/archives/1578
5. Configure Thin and Nginx .
-
2012/07/12 Updates:By using the installation script provided by NginX official site will cut huge amounts of trouble for you.You can download the script from: http://nginx.org/en/docs/howto_setup_development_environment_on_ec2.html
6. Launch!
There’re several tips I learned from this installation process.
- You need to put your rails app folder under /var/yourapp in order to get read authority.
- You don’t have to stop Nginx to reload your configuration, just type: nginx -s reload.
- 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.