Accessing nginx index.html on EC2 - nginx

I'm trying to stand up an EC2 instance with elastic search using nginx as an front end node access point. I used this tutorial to set it up.
http://nginx.com/resources/admin-guide/setting-nginx-plus-environment-amazon-ec2/
According to it I should be able to "check it by pointing your web browser to the public DNS name of your newborn EC2 instance."
But when I go to the ec2 domain in a browser I get json of the cluster status.
I have an index.html that I've place in /var/www/index.html but I am unable to access it from a browser.

I am not sure what I did wrong but I used this example instead and it's all working ok.
http://www.comtechies.com/2014/03/How-to-install-and-configure-nginx-on-amazon-ec2.html

Related

Get refused to connect

Okay, just need a little help here before I pull what hair I have left out of my head. I've created a website (let's call it example.com). In the URL I can put the http://192.168.1.39, http://example.com, and example.com and they all return the web page I'm expecting. But if I put in http://www.example.com I get "This site can't be reached, refused to connect".
If you need more info, please let me know so that I can provide it, but I have set up my apache2 according to a few other websites that inform you how to set up a web server. I'm also running Oracle VM as well.
Thank You

How to set up SSL with CloudFront for EC2 Instance (Wordpress)

I followed this
guide to setup WordPress on EC2, but it doesn't cover how to enable HTTPS. I've used the 'WordPress Certified by Bitnami and Automattic' AMI.
I know I can use CloudFront infront of EC2 for SSL, but I'm having trouble getting it working. I've gotten Error 502 plus several others. So I'd like to start from scratch and confirm my approach is correct.
I've registered my own domain (example.com). In Route 53, I have 'blog.example.com' as an A record pointing to my instance's EIP. I also have a CNAME record for 'www.blog.example.com' pointing to 'blog.example.com'. Both URLs can access my instance via HTTP.
In CloudFront's configuration, my 'Origin Domain Name' is:
Public DNS (ec2-XX-XX-XX-XX.ap-southeast-2.compute.amazonaws.com)
'Origin Protocol Policy' is set to HTTP
'Viewer Protocol Policy' is set to 'Redirect HTTP to HTTPS'.
For SSL Certificate, I've requested a custom cert for both:
blog.example.com
www.blog.example.com
All other CF settings have been left as default. I can access the distribution's domain name but its still HTTP.
After the Distribution is deployed, I've change the 'blog.example.com' record in Route 53 to have an alias target of CF's domain name (xxxxxxxxxxx.cloudfront.net).
What about the CNAME record (www.blog.example.com), should it be amended aswell?
Up to this stage, I can access both 'www.blog.example.com' and 'blog.example.com' but its HTTP and the EIP appears in the URL bar, not domain names.
What am I missing or have setup incorrectly?
I'm super new to AWS so many thanks in advance!
I am not sure if you are still looking for a solution but here is how I accomplished setting up SSL on my ec2 instance.
1) I issued a SSL Certificate for the URL that the ec2 was pointed at. I used AWS Certificate Manager to accomplish this.
There are two ways to verify domain authority DNS and Email. I have found DNS to be much easier, especially if you are using Route 53.
2) Next I had to list the alternate CNAME's to both of my A records (www.example.com & example.com) within Cloudfront (this tutorial was helpful). After selecting the Cloudfront distribution under the General tab click the Edit button. You will need to import your SSL certificate by selecting the radio button: Custom SSL Certificate (example.com) and then selecting the appropriate certificate that you created in Step 1.
Do keep in mind some of these steps required 15-20 minutes for the changes to propagate.
3) The final step is to point the A record within Route 53 to the Cloudfront distributions domain name.
The three AWS services you will need to utilize to accomplish this are Route 53, Cloudfront (CDN), and Certificate Manager.
Hope this helps and good luck!
Your aws configuration is looking fine. The problem is with your wordpress url, In wp-config.php you can identify the siteurl to your "domain.com" or you can set it through manually entering "domain.com" in the database. Make sure you enter https://youdomain in siteurl field.

Route subdomain to a path in a Dokku app using Nginx

I have a few apps running in a aws instance with Dokku. I'm using virtual hostname, and together with some DNS configuration of my registered domain, I have the following for one of them: mydomain.com is a CNAME record pointing to the aws instance address, and Dokku+nginx take care of redirecting to the correct app/process.
The path for all API calls is /parse, as I'm using the open source Parse Server. The final server url is mydomain.com/parse.
What I want to achieve, ideally, is the following: api.mydomain.com gets redirected to mydomain.com/parse, api.mydomain.com/someFunction to mydomain.com/parse/someFunction and so on.
When researching to see how this may be possible, I found that this can be done easily with nginx, like explained here in this answer.
I can even change manually the nginx config file, but I'm afraid that it will be overwritten in future changes. How can this ideally be achieved with nginx on Dokku?

How to force canonical URL in Meteor hosted on Bluemix?

I deployed a Meteor app to IBM Bluemix which created an address like myapp.mybluemix.net.
Inside Bluemix panel, since we have our own custom domain, I registered it with the address myapp.com and then I created three routes: myapp.mybluemix.net, myapp.com and www.myapp.com. I also created an enviroment variable ROOT_URL = 'www.myapp.com', since we want the www. version to be used instead of the naked domain.
Inside the DNS provider panel, I put a CNAME record as www.myapp.com CNAME myapp.mybluemix.net and a A record as myapp.com A XXX.XXX.XXX.XXX (pointing to the public IP of Bluemix host).
With all these, my app was opening well, but with duplicated URLs. Then I discovered the Canonical package and republished my app with it included hoping to solve the canonical need.
Unfortunately, all requests both to myapp.com and www.myapp.com redirects to myapp.mybluemix.net!
I can't see what configuration is causing this problem. What of the described steps I went wrong?
Following steps helped me configure canonical URL :
1) Install the canonical meteor package
2) Configure two routes to your application (naked and www subdomain)
3) Set CF environment variable : cf set-env leadershipboard ROOT_URL "http://www.vamsee.ml"
4) Configure DNS server CNAME to route traffic to Bluemix application :
5) Use slightly modified meteor buildpack : https://github.com/JProgrammer/cf-meteor-buildpack
Hope it helps.
I think that very probably the error is not with the custom domain configuration (which is working fine because according to your description all the routes are resolved correctly) but with the www redirect you are doing to make the www.myapp.com the default host.
If you provide more details about you have implemented it we could help you in finding out what could be wrong

Nginx returning a 400 error when trying to point a new domain at an existing subdomain

I have a domain running
http://www.exampledomain.com
and I have a subdomain that is working correctly at
http://mysub.exampledomain.com
both have web pages being served by nginx and I am able to hit both of those without a problem.
I have another domain that I want to point at that subdomain so it serves the same pages without redirecting the url.
http://www.myotherdomain.com
On that domain I setup these records
host name: www
ip address/url: mysub.exampledomain.com.
record type: CNAME (alias)
host name: #
ip address/url: mysub.exampledomain.com.
record type: CNAME (alias)
Now when I try to load http://www.myotherdomain.com I get a 400 error coming from nginx. Because it's an nginx error I'm assuming the dns is making it through but I could be wrong. Do I need to do something to let nginx or ubuntu be ok with serving requests from this domain? Modify my hosts file or something?
Edit: Now that it's been a little bit I'm no longer getting the error but It's loading the content of my first url. So using the psuedo domains above... www.myotherdomain.com is now loading the content of www.exampledomain.com instead of mysub.exampledomain.com
I was able to get this working by changing my record types from CNAMEs to URL frames. If anyone has more knowledge on the subject I would still love to know why my previous setup was causing nginx errors and this one isn't.

Resources