title: Serving React and Django with SSL and a domain
body: <p>Currently, I'm deploying a react app and using django as the backend API on an ubuntu nginx server. The react app is already online have a SSL certificate, but the backend API does not. By default, browsers can't show a http content on a https connection.</p>
  <p>Do I need to get another SSL certificate afor the backend API? Or is there another way to do it?</p>
  <p>Nginx conf file (for the frontend part. I'm not sure how to configure the backend):</p>
  <p>The backend is currently running on xxx.xx.x.xx:8000 (using gunicorn --daemon --bind xxx.xx.x.xx:8000)</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>server {
     server_name xxxxxx.com www.xxxxxx.com xxx.xx.x.xx;
     root /var/www/frontend/build;
     index index.html index.htm;
     location / {
     try_files $uri $uri/ /index.html =404;
     }
  
  
      listen 443 ssl;
      ssl_certificate /etc/letsencrypt/live/fromnil.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/fromnil.com/privkey.pem;
      include /etc/letsencrypt/options-ssl-nginx.conf;
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
  
  
  }
  server {
      if ($host = www.xxxxxx.com) {
          return 301 https://$host$request_uri;
      }
  
  
      if ($host = xxxxxx.com) {
          return 301 https://$host$request_uri;
      }
  
  
     server_name xxxxxx.com www.xxxxxx.com xxx.xx.x.xx;
      listen 80;
      return 404;
  
  
  
  
  }</code></pre>
  </div>
  </div>
  </p>
  <p>Thanks</p>
  <p>Found this link, but wasn't able to post a comment because my reputation is not enough. And I don't really understand. Can anyone help me?</p>
  <p><a href="https://stackoverflow.com/questions/50544672/how-to-deploy-react-and-django-in-aws-with-a-ssl-and-a-domain">How to deploy react and django in aws with a ssl and a domain</a></p>