title: How to configure nginx as proxy_pass?
body: <p>I have use Certbot Nginx to install my nginx to Ubuntu 18.04. I also use Certbot to get the LetsEncrypt certificate.</p>
  
  <p>I use basic configuration such as use tcp 80 and 433 so I can get both http and https. Most of the configuration done by Certbot.</p>
  
  <p>my domain is <a href="http://example.com" rel="nofollow noreferrer">http://example.com</a> and provides static page. Bu I also have a folder and I can call it with <a href="http://example.com/myfolder" rel="nofollow noreferrer">http://example.com/myfolder</a>.</p>
  
  <p>After I install nginx I try to use proxy_pass and https to my local rest_api services.</p>
  
  <p>If I type <a href="http://127.0.0.1:1024/myfolder" rel="nofollow noreferrer">http://127.0.0.1:1024/myfolder</a> then I can see my rest-api works.
  If I type <a href="https://example.com/myfolder" rel="nofollow noreferrer">https://example.com/myfolder</a> than nginx is not activate <code>proxy_pass</code>. mystic.com has registered and it works more than 8 months. All the dns configuration is working. Also nginx letsencrypt is working. 1 week ago my certificate automatically update itself (every 90 days).</p>
  
  <p>My Nginx Configuration is below. my <code>nginx</code> version is <code>1.15.10</code>.</p>
  
  <ol>
  <li>How to configure nginx as proxy_pass?</li>
  <li>Is my proxy_pass is correct?</li>
  <li>how can I change this line <code>try_files $uri $uri/ =404;</code> to show <code>var/www/html/index.html</code>?</li>
  </ol>
  
  <pre><code>    server {
          charset UTF-8;
          listen 80 ;
          listen [::]:80 ;
  
          server_name example.com; # managed by Certbot    
  
          if ($host = example.com) {
              return 301 https://$host$request_uri;
          } # managed by Certbot
          return 404; # managed by Certbot
      }
  
      server {
          charset UTF-8;
          listen [::]:443 ssl ipv6only=on; # managed by Certbot
          listen 443 ssl; # managed by Certbot
          server_name example.com; # managed by Certbot
  
          ssl_certificate /mypath/example.com/fullchain.pem; # managed by Certbot
          ssl_certificate_key /mypath/example.com/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
  
          location / {
          # First attempt to serve request as file, then
          # as directory, then fall back to displaying a 404.
              try_files $uri $uri/ =404;
              proxy_pass http://127.0.0.1:1024/;
         }
      }
  </code></pre>