To make your domain listen on www.example.com instead of example.com you have to do the following steps. (Make sure you replace example.com with your own domain)
- Change the server_name variable inside your nginx config. You can find this config file in this path (or you can use our UI to edit): /etc/nginx/sites-available/example.com
- (Optional): If you have SSL enabled, you will have to edit the redirect too. Open up this file: /etc/nginx/ploi/example.com/before/ssl-redirect.conf and edit these lines:
return 301 https://example.com$request_uri;
return 301 https://www.example.com$request_uri;
3. After this, save these files and restart NGINX.