title: nginx reverse proxy - only works on /
body: <p>On my NAS I'm running seafile as an alternative to dropbox/owncloud. I'm using nginx and reverse proxy to serve the webgui using/forcing SSL. Everything for this works fine.</p>
  
  <p>Now, I want to set up some other locations for other things running on the NAS (couch potato, plex etc). This is the relevant part of my nginx.conf file:</p>
  
  <pre><code>server {
      listen 80;
      server_name domain.net, 192.168.1.50;
  
  rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
  
  }
  
  
  
  server {
          listen 443;
          ssl on;
          ssl_certificate C:/nginx-1.6.3/conf/ssl/ssl-bundle.crt;        # path to your ssl certificate
          ssl_certificate_key C:/nginx-1.6.3/conf/ssl/server.key;    # path to your private key
  
          server_name domain.net, 192.168.1.50;
  
          proxy_set_header X-Forwarded-For $remote_addr;
  
          add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
          server_tokens off;
  
      location /couchpotato {
          proxy_pass http://127.0.0.1:5050;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
  
          location /cloud {
              fastcgi_pass    127.0.0.1:8000;
              fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
              fastcgi_param   PATH_INFO           $fastcgi_script_name;
  
              fastcgi_param   SERVER_PROTOCOL        $server_protocol;
              fastcgi_param   QUERY_STRING        $query_string;
              fastcgi_param   REQUEST_METHOD      $request_method;
              fastcgi_param   CONTENT_TYPE        $content_type;
              fastcgi_param   CONTENT_LENGTH      $content_length;
              fastcgi_param   SERVER_ADDR         $server_addr;
              fastcgi_param   SERVER_PORT         $server_port;
              fastcgi_param   SERVER_NAME         $server_name;
              fastcgi_param   HTTPS               on;
              fastcgi_param   HTTP_SCHEME         https;
  
              access_log      logs/seahub.access.log;
              error_log       logs/seahub.error.log;
          }
  
          location /seafhttp {
              rewrite ^/seafhttp(.*)$ $1 break;
              proxy_pass http://127.0.0.1:8082;
              client_max_body_size 0;
              proxy_connect_timeout  36000s;
              proxy_read_timeout  36000s;
          }
  
      location /seafmedia {
              rewrite ^/seafmedia(.*)$ /media$1 break;
              root C:/Seafile/seafile-server-4.0.6/seahub;
          }
  
          location /media {
              root C:/Seafile/seafile-server-4.0.6/seahub;
          }
  
      }
  </code></pre>
  
  <p>visiting domain.net/cloud (or 192.168.1.50/cloud) gets me to seafile without a problem. visiting domain.net gives me the default nginx page, which makes sense as no location is defined for that</p>
  
  <p>the problem is going to domain.net/couchpotato takes me to <a href="https://domain.net/#couchpotato" rel="nofollow">https://domain.net/#couchpotato</a> and it doesnt load</p>
  
  <p>if in the nginx.conf file I change <code>location /couchpotato {}</code> to <code>location / {}</code> then couchpotato will load correctly</p>
  
  <p>Im pretty sure theres something wrong in the way I've configured nginx but Im not sure what that is as this is my first time using it</p>
  
  <p>So my question is, why is it that using /couchpotato as a location does not work? But using / does?</p>