Docker and React js host in same droplet with subdomain Nginx

Posted August 4, 2021 469 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

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.

Submit an Answer
1 answer


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.