Redirect to Non-WWW with SSL on Ngnix

How can redirect to non-www with ssl (https://www.example.com). I use this code in : /var/www/domain.com/conf/nginx/ssl.conf

but It just work with HTTP not HTTPS.

server { server_name www.example.com; return 301 https://example.com$request_uri; }