If you want to make sure all traffic only uses your preferred domain name you can create a new server {} block that redirects to the preferred domain name.
On your nginx node select config and edit the nginx.conf file.
In this example we'll redirect my-site.jelastic.elastx.net to https://my-domain.tld
server {
server_name my-site.jelastic.elastx.net;
listen 80 default_server;
return 301 https://my-domain.tld/$request_uri;
}
Comments
I was not able make to work. I edited the nginx.conf file and added the server directive to the end of file.
I got the error message saying that "server" directive is not allowed there.
Please sign in to leave a comment.