title: Laravel Forge Nginx redirecting all subdomains to https://example.com
body: <p>So I'm using Laravel Forge's built-in features to generate and integrate a LetsEncrypt certificate. But I'm having issues with getting my subdomains to work. </p>
  
  <p>Whenever I try to go to www.example.com or <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a>, it redirects me to <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a>. The same happens when I try to add more subdomains, like foo.example.com redirects to <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a></p>
  
  <p>I have my domain hosted with Namecheap and set it up as so:</p>
  
  <p><a href="https://i.stack.imgur.com/4bWQQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4bWQQ.png" alt="enter image description here"></a></p>
  
  <p>This is my Nginx configuration file as generated by Forge:</p>
  
  <pre><code># FORGE CONFIG (DOT NOT REMOVE!)
  include forge-conf/example.com/before/*;
  
  # FORGE CONFIG (DOT NOT REMOVE!)
  include upstreams/example.com;
  
  server {
      listen 443 ssl;
      listen [::]:443 ssl;
      server_name example.com;
  
      # FORGE SSL (DO NOT REMOVE!)
      ssl_certificate /etc/nginx/ssl/example.com/244866/server.crt;
      ssl_certificate_key /etc/nginx/ssl/example.com/244866/server.key;
  
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  
      charset utf-8;
  
      access_log off;
      error_log  /var/log/nginx/example.com-error.log error;
  
      # FORGE CONFIG (DOT NOT REMOVE!)
      include forge-conf/example.com/server/*;
  
      location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_set_header Host $http_host;
          proxy_set_header X-NginX-Proxy true;
  
          proxy_pass http://386082_app/;
          proxy_redirect off;
  
          # Handle Web Socket Connections
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
      }
  }
  
  # FORGE CONFIG (DOT NOT REMOVE!)
  include forge-conf/example.com/after/*;
  </code></pre>
  
  <p>This is the first time I'm using an Nginx server so I'm not sure how to change that. I've tried playing around with my settings in Namecheap DNS settings, and making sure my SSL is generated with all the subdomains, but I don't the the issue is anywhere but within the nginx configuration. Searching around didn't give me a solid solution as I don't want to ward too far away from the default configuration by Forge, yet still manage to this work my way. </p>
  
  <p>Any and all help will be highly appreciated!</p>
  
  <p>Thank you</p>