Setup NGINX with wildcard ssl certificate

Setup NGINX with wildcard ssl certificate

server {
  listen 80;
  listen [::]:80;
  server_name *.yamicode.com;
  return 301 https://$host$request_uri;
}

server {
  listen 443 ssl;
  server_name *.yamicode.com;
  ssl_certificate /path/to/public/certif.pem;
  ssl_certificate_key /path/to/privkey.pem;
  root /path/to/root;
  index index.html;
  location / {
    try_files $uri $uri/ =404;
  }
}