Also you need to create a DNS record to your (www) subdomain.
example.com is your domain (zone) and
www.example.com is your subdomain such as
w3.example.com, but the commonly used subdomain is www by convention.
Let’s say you have a A record in your DNS for your domain like this
@ A 192.168.0.1
People can reach your site just typing http://example.com in the URL bar of the browser. Now if you need to expose your site as http://www.example.com you can do this in several ways, these are two of them.
By adding a new A record in your DNS zone.
www A 192.168.0.1
By adding a CNAME record in your DNS zone.
www CNAME @
I would prefer the option 2 but it’s your choice.
Hope this helps you. :)