title: Why does Nginx keep redirecting me to localhost?
body: <p>Using Django on the backend with Gunicorn, each time I submit a form and am supposed to be sent to <code>example.com/pagetwo</code> I am sent to <code>localhost/pagetwo</code> instead.</p>
  
  <p>I'm new to Nginx so if someone could point out what the problem is I'd be most greatful :)</p>
  
  <p>default.conf:</p>
  
  <pre><code>server {
      listen       80;
      server_name  example.com;
  
      location /static/ {
          root /srv;
      }
  
      location / {
          proxy_redirect off;
          proxy_pass http://unix:/srv/sockets/website.sock;
      }
  
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   /usr/share/nginx/html;
      }
  }
  </code></pre>
  
  <p>Here is a form from the index page:</p>
  
  <pre><code>&lt;form id='formone' method='POST' action=''&gt; {% csrf_token %}
      {{ form.as_p }}
      &lt;br /&gt;
      &lt;button type="submit" class="btn btn-success btn-sm"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>