Question

Docker and React js host in same droplet with subdomain Nginx

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;
    server_name e-deshdelivery.com;

    ssl_certificate           /etc/nginx/e-deshdelivery.com.pem;
    ssl_certificate_key       /etc/nginx/e-deshdelivery.com.key;

    # 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 https://e-deshdelivery.com;
    }
  }

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


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

I just came across this quesiton. The configuration looks correct, but what you need to keep in mind is that you can not have more than 1 service listening on the same port.

So if your Docker container is listening on port 5000 you can not have another application listening on that same address.

Best, Bobby