config nginx to serve vuejs app on subdomain listening on 443

I want to run vuejs app on, and I simply configure nginx like bellow:

server {
   listen 80;
   listen 443;
   ssl on;
   ssl_certificate /etc/nginx/ssl/xxx.pem;
   ssl_certificate_key /etc/nginx/ssl/xxx.key;

   charset utf-8;
   root    /var/www/xxx/dist;
   index   index.html index.htm;

   location / {
      root /var/www/xxx/dist;
      try_files $uri /index.html;
   error_log  /var/log/nginx/xxx-error.log;
   access_log /var/log/nginx/xxx-access.log;

but when I apply this configuration, the vuejs app loads on main domain ( and breaks the website. I can not understand what is wrong here!
and also when I remove the lines related to ssl, all is good and it works as I expect on http