Docker and React js host in same droplet with subdomain Nginx

Posted August 4, 2021 183 views

As I am new to DigitalOcean I want to know how can I hot my docker file and at the same time I want to host my React js front end in the same droplet with nginx. I am able to host my docker file in port 5000.

below is my configuration file with my domain name

server {
    listen 80;
    return 301 https://$host$request_uri;

server {

    listen 443 ssl;

    ssl_certificate           /etc/nginx/;
    ssl_certificate_key       /etc/nginx/;

    # ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    access_log            /var/log/nginx/e-desh.access.log;

 location / {

      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;

      # Fix the “It appears that your reverse proxy set up is broken" error.
      proxy_pass          http://localhost:5000;
      proxy_read_timeout  90;

      proxy_redirect      http://localhost:5000;

*# please Help me! It’s urgent. *

edited by bobbyiliev
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!