My site is up and running and can be found on the Internet by typing [domain].com
address in the browser.
When I try to access it using www.[domain].com
, it return an error (not found).
I'm using Route 53 as a DNS Server with the following configuration:
(Addresses, IP's and tokens are not real)
At my server I have the following configuration (NGINX):
server {
listen 80 default_server;
root /var/www/domain;
index index.html index.htm;
location /api {
proxy_redirect http://localhost:3001/ /api;
proxy_pass_header Server;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_connect_timeout 5;
proxy_read_timeout 240;
proxy_intercept_errors on;
proxy_pass http://localhost:3001;
}
location /graphql {
proxy_redirect http://localhost:3001/ /graphql;
proxy_pass_header Server;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_connect_timeout 5;
proxy_read_timeout 240;
proxy_intercept_errors on;
proxy_pass http://localhost:3001;
}
# Root route
location = / {
try_files $uri /app/index.html;
}
# Any other route default to landing
location / {
try_files $uri $uri/ /app/index.html;
}
}
I need to make my site working for both [domain].com
and www.[domain].com
, as well as showing the correct name www.[domain].com/page
in the browser does not matter how it was accessed.
Help appreciated.