title: NGINX - "server" directive is not allowed here
body: <p>I'm trying to reconfigure my NGINX install to proxy to the local ghost install.</p>
  
  <p>In addition to that, I'm adding SSL (letsencrypt) but I keep getting an error.</p>
  
  <p>The error I get is - </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>nginx -t -c /etc/nginx/sites-available/ghost
  nginx: [emerg] "server" directive is not allowed here in /etc/nginx/sites-available/ghost:1
  nginx: configuration file /etc/nginx/sites-available/ghost test failed</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my config </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>server {
         listen         80;
         server_name    domainnamehere.com;
         return         301 https://$server_name$request_uri;
  }
  
  server {
          listen 443;
          server_name www.nonstopdev.com;
          access_log      /var/log/nginx/domainnamehere.com.access.log;
          error_log       /var/log/nginx/domainnamehere.com.error.log;
  
          ssl on;
          ssl_certificate         /etc/letsencrypt/live/domainnamehere.com/fullchain.pem;
          ssl_certificate_key     /etc/letsencrypt/live/domainnamehere.com/privkey.pem;
  
  
          location / {
                  proxy_set_header   X-Real-IP $remote_addr;
                  proxy_set_header   Host      $http_host;
                  proxy_pass         http://127.0.0.1:2368;
          }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The following config works fine without any issues - </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>server {
      listen 80;
      server_name mydomainname.com;
      location / {
          proxy_set_header   X-Real-IP $remote_addr;
          proxy_set_header   Host      $http_host;
          proxy_pass         http://127.0.0.1:2368;
      }
  }</code></pre>
  </div>
  </div>
  </p>