Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Install NGINX in EC2 instance

Posted on Jul 16 In this tutorial, I will walk you through how to setup Nginx in AWS EC2 Instance.The tutorial only focuses on the manual operations of creating EC2 from AWS console, and commands to setup NGINX in the instance. We won't dive into the NGINX concepts and advanced features.Firstly, let's create an EC2 instance from AWS console by clicking on the button Launch Instances on the right top corner of the EC2 page.A form shows up to let you fill in some properties before the instance get launched.The pem key is used to SSH into the instance. This is the only opportunity to download it from AWS console, and there is no chance to replace key pair for instance. You should never share the key or delete the key unless you are sure about the effect. If you choose to create a new security group, make sure to enable all SSH traffic from Anywhere, or specified IP address range. It will add an inbound rule to your security group to allow traffic from the selected IP address range through port 22. For best practice, you should always avoid exposing instances to the Internet for security. Click on Connect, connect to your EC2 instance following the guide for SSH client option.Follow the above guide and run commands in the terminal. A welcome tip shows up when you enter the instance successfully.As mentioned early. the security group we created when launching an EC2 has an inbound rule to allow SSH via port 22 from the internet (0.0.0.0/0). You may encounter a timeout issue if your security group doesn't open the rule. Add an inbound rule for SSH from 0.0.0.0/0 to the security group via port 22 as needed.Now, we are ready to install NGINX in the instance. Execute the command below. Just follow up by pressing "y" when the installation interacts with you.It probably returns an error "yum: command not found" if the instance AMI is not Amazon Linux. For Ubuntu based AMI, use "apt" instead of "yum".After installing NGINX, execute the command below to start and validate NGINX.Add security group inbound rules to open HTTP and HTTPS to allow inbound traffic from the internet to instance via port 80 and 443. Again, you should never expose your instance to the Internet. Find the public IP assigned to your instance automatically from AWS console, visit the index.html page of NGINX via http://ip-address. The NGINX default welcome page is returned as below. Now, we install NGINX in EC2 instance successfully.Thanks for reading and appreciate your comments on content and grammar! Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Jakob Ondrey - Jun 20 OMKAR KADAM - Jul 1 🚀 Vu Dao 🚀 - May 31 Ricardo Sueiras - Jun 19 Once suspended, camillehe1992 will not be able to comment or publish posts until their suspension is removed. Once unsuspended, camillehe1992 will be able to comment and publish posts again. Once unpublished, all posts by camillehe1992 will become hidden and only accessible to themselves. If camillehe1992 is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to Camille He. They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag camillehe1992: camillehe1992 consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging camillehe1992 will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

Install NGINX in EC2 instance

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×