This article will show you how to install nginx on Ubnutu on your aws ec2 server.

Create a new ec2 server on AWS


  1. Apply a new AWS account

  2. Check a VPC

If you created your AWS account after 2013-12-04, it supports only EC2-VPC. In this case, you'll have a default VPC in each AWS region. A default VPC is ready for you to use — you can immediately start launching instances into your default VPC without having to perform any additional configuration steps.
  1. Go to ec2, and create a server

  2. Choose Unbuntu

  3. Check network and subnet is default vpc and subnet.

  4. Select default security group, if not create a new one

  5. Go to Elastic ips, then allocate new address. (It will take monthly fee)

  6. Bind the elastic ip to your instance

  7. Go to securtiy group, and eidt inbound rules

    • HTTP TCP 80 anywhere
    • SSH TCP 22 anywhere
  8. Use ssh to connect to your server

Install nginx on unbuntu


sudo apt-get update
sudo apt-get install nginx
curl http://icanhazip.com
# get ip address and enter it into your browser.

if you see the following page, it means the nginx web server is successfully installed.

Other


AWS引入了zone的概念, 他將zone分為兩種: 地理區域(Region Zone)和可用區域(Availability Zone), 其中Region Zone是按照實際的地理位置劃分的. 而Availbility Zone一般是按照數據中心劃分的.

Reference