Fix undefined method `sort_by' error from vhost_location_empty.erb

I got the following error:

    Filepath: /etc/puppet/modules/common/nginx/templates/vhost/vhost_location_empty.erb
    Line: 2
    Detail: undefined method `sort_by' for nil:NilClass
    at /etc/puppet/modules/common/nginx/manifests/resource/location.pp:133 on node xxxxxx

In the template, we should check if the variable is defined before use it.