title: Nginx reverse proxy return 502
body: <p>I'm very new to nginx and server game and i'm trying to setup a reverse proxy. Basically what i need is when i enter my server ip it should open a particular website (Ex: <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a>).</p>
  <p>So for example if i enter my ip (Ex: 45.10.127.942) it should open the website example.com , but the url should remain as <a href="http://45.10.127.942" rel="nofollow noreferrer">http://45.10.127.942</a>.</p>
  <p>I tried to set my server configuration as follows but it returns a 502 error.</p>
  <pre><code>server {
      listen 80;
      location / {
          proxy_pass http://example.com;
      }
  }
  </code></pre>
  <p>It returns a 502 error. Can you please explain what i need to do?</p>