Now i have a rails app configured succesfully on Amacon EC2.I successfully configured both nginx and unicorn and now i can see this url as myipaddress/login
but want to access using domain name.
This is the problem as i have already changed hosts file and added the below after ssh in ec2 instance:-
127.0.0.1 www.mysite.com
#Virtual Hosts
myipaddress www.mysite.com
myipaddress mysite.com
also my /home/ubuntu/shareit/config/nginx.conf
file looks like this:-
upstream unicorn {
server unix:/home/ubuntu/shareit/tmp/sockets/unicorn.shareit.sock fail_timeout=0;
}
server {
listen 80;
#listen [::]:80 ipv6only=on default_server;
server_name mysite.com www.mysite.com;
root /home/ubuntu/shareit/public;
access_log /home/ubuntu/shareit/log/access.log;
error_log /home/ubuntu/shareit/log/error.log;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
but still whenever i try to hit the url www.mysite.com
instead of myipaddress/login
(which is working) i get error as This web page is not available.
so am i missing something?i dont want to hit my app using ipaddress.i even tried using app name in routes.rb
,but its still not working.
i even flushed UBUNTU dns using sudo /etc/init.d/nscd restart
and restarted nginx and unicorn,but it doesnt works?
Any help would be appreciated?
Whats is the output of
ping myipaddress www.mysite.com
If it's able to resolve correctly, setup a Route53, all the configuration seems to ok, you just need a "A" record