Every time instead domain browser in address line display ip address of server.
Please let me know how can I redirect it to my domain? I have following setting, but dont work.
upstream app {
server unix:/home/deploy/sharetribe/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
listen [::]:80;
root /home/deploy/sharetribe/public;
try_files $uri/index.html $uri @app;
location @app {
proxy_pass http://app;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
server_name domain.name www.domain.name;
location / {
# root /home/deploy/sharetribe/public;
try_files $uri @app;
gzip_static on;
expires max;
proxy_read_timeout 150;
add_header Cache-Control public;
}
}
server {
listen 80;
server_name 12.123.12.12;
add_header X-Frame-Options "SAMEORIGIN";
#rewrite .* http://domian.name$request_uri permanent;
return 301 $scheme://domain.name$request_uri;
}
UPDATE:
root@a:~# curl -I http://domain.name/
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.2
Date: Sat, 11 Mar 2017 19:42:06 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: http://domain.name/
X-Frame-Options: SAMEORIGIN
Display error in google chrome: domain.name redirected you too many times.