Here is an example how to force no-www domain on Servepilot VPS servers with Nginx.
Create /etc/nginx-sp/vhosts.d/servermeister.d/0www_redirect.conf
with code that will force all www pages 301 redirect to a naked no-www domain.
Code:
if ($host ~* www.servermeister.com$) { return 301 https://www.servermeister.nl$request_uri; }
restart nginx with the command
Code:
sudo service nginx-sp restart
If you would like to force all no-www pages to www.
Code:
if ($host ~* techcat.ca$) { return 301 https://www.servermeister.nl$request_uri; }
More info on Nginx redirects
https://serverpilot.io/community/articles/how-to-redirect-based-on-the-requested-domain-name.html