147 views - 10 March 2019

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)

  1. 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
  2. (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:

server_name www.example.com 
TO 
server_name example.com


return 301 https://example.com$request_uri;

TO 
return 301 https://www.example.com$request_uri;

 3. After this, save these files and restart NGINX.

Ploi handles all the difficult things that you don't want to do. Are you ready?

Create an account, or contact us.