title: nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/sites-enabled/wiki.[site].com:48
body: <p>I'm trying to configure a mediawiki instance with Nginx. I've done it before, on another server, and it worked fine there. However, when I copy the same nginx vhost file over to this server (changing relative bits like the server_name), nginx gives me the following error:</p>
  <pre><code>nginx: [emerg] &quot;upstream&quot; directive is not allowed here in /etc/nginx/sites-enabled/wiki.[site].com:48
  </code></pre>
  <p>On my other server, this gives me no errors at all and works exactly as intended. I'm using the same version of nginx (1.14) on either server, and the nginx.conf files are identical.</p>
  <p>I'm completely stumped, any help would be massively appreciated.</p>
  <p>The full vhost file is as follows:</p>
  <pre><code>server {
          listen 80;
          listen [::]:80;
          server_name wiki.[site].work;
          return 301 https://wiki.[site].work$request_uri;
  }
      
  server {
          listen [::]:443 ssl; # managed by Certbot
          listen 443 ssl; # managed by Certbot
      
          server_name wiki.[site].work;
          root /var/www/wiki.[site].work;
          index index.php;
          autoindex off;
      
      
          ssl_certificate /etc/letsencrypt/live/[site].work/cert.pem; # managed by Certbot
          ssl_certificate_key /etc/letsencrypt/live/[site].work/privkey.pem; # managed by Certbot
          include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
          ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
      
          client_max_body_size 5m;
          client_body_timeout 60;
      
          location / {
              index index.php5;
              rewrite ^/([^?]*)(?:\?(.*))? /index.php5?title=$1&amp;$2 last;
          }
          location ~ \.php5?$ {
              try_files $uri =404;
              include fastcgi_params;
              fastcgi_pass php5-fpm-sock;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              fastcgi_intercept_errors on;
              fastcgi_param HTTPS on;
          }
      
          location ~ \.php?$ {
              try_files $uri =404;
              fastcgi_param HTTPS on;
              include fastcgi_params;
              fastcgi_pass php5-fpm-sock;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              fastcgi_intercept_errors on;
          }
      
          upstream php5-fpm-sock {
              server unix:/var/run/php5-fpm.soc;
              fastcgi_param HTTPS on;
          }    
  }
  </code></pre>