Fixing 502 Bad Gateway Nginx

Поділитися
Вставка
  • Опубліковано 10 вер 2024
  • This video shows you how to fix the 502 Bad gateway and "connect() failed (111: Connection refused) while connecting to upstream" Nginx errors!
    Useful links:
    - Affiliate link for $100 free credit for DigitalOcean so you could spin up your own servers:
    m.do.co/c/2a9b...
    - How to Troubleshoot Common Nginx Issues on Linux Server:
    www.digitaloce...
    - More useful Nginx discussions:
    www.digitaloce...
    www.digitaloce...
    - Twitter:
    / bobbyiliev_

КОМЕНТАРІ • 58

  • @bobbyiliev_
    @bobbyiliev_  3 роки тому +5

    If you have any questions feel free to reach out to me! 🙌
    Best way to do that is to post a question on the DigitalOcean community forum here:
    www.digitalocean.com/community/questions

  • @GlaucoHass
    @GlaucoHass 3 роки тому +2

    I just have to say that this video is incredibly well done, very simple and yet well put steps for everything, to the point of feeling embarrassed after you watch, because those steps should really be simple and make sense right away. Thank you very much.

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому +1

      Thank you very much for your feedback! I am really happy to hear that this helped you!

  • @xinyansun9174
    @xinyansun9174 3 роки тому +2

    Thank you so much! I followed your steps and it was indeed because I accidentally closed my node server. Now I feel stupid

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      No problem at all! Thank you for the nice feedback and happy to hear that this helped you!

  • @BruceWayne-cb8xj
    @BruceWayne-cb8xj 3 роки тому +2

    Brilliant! This video helped me a lot. Thank you and keep it up👍

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      Thanks! Happy to hear that this was helpful! 🙌

  • @johntovor605
    @johntovor605 3 роки тому +1

    Thank you so much Champ.
    You have saved me a lot.
    Great solution.

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      No problem at all! Happy to hear that this was helpful!

  • @paulrodaslema
    @paulrodaslema 2 роки тому +1

    Very useful and meaningful content, THANKS!

  • @ramn4775
    @ramn4775 Рік тому

    Hi,I got 502 bad gateway nginx error on browser after calling DRF api..can you plz tell me how to fix this

  • @FRESHGAMENEWS
    @FRESHGAMENEWS 10 місяців тому

    When i type docker ps -a the container is empty. What can i do about it?

  • @rafatahmed1126
    @rafatahmed1126 2 роки тому +2

    saved my day thanks

  • @muhammadshehroze6691
    @muhammadshehroze6691 Рік тому

    i have same problem but u give solution for docker file , how i can solve it in ubuntu cli terminal

  • @RajeshShrestha-sc4io
    @RajeshShrestha-sc4io Рік тому

    Very Useful. Thank you for the video.

  • @alexgodwin5806
    @alexgodwin5806 2 роки тому +1

    Thanks a lot Bobby Iliev

  • @aslanhuseynov3481
    @aslanhuseynov3481 3 роки тому +1

    Hello bro. when I type sudo cat /etc/nginx/sites-enabled/default there is a error like this: cat: /etc/nginx/sites-enabled/default: No such file or directory . what is wrong? thank you very much.

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому +1

      Hi there 👋, what OS are you using? You can check the OS with this command:
      cat /etc/os-release

    • @aslanhuseynov3481
      @aslanhuseynov3481 3 роки тому

      @@bobbyiliev_ Linux / Ubuntu.

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      @@aslanhuseynov3481 Hello, it is possible that you have a different Nginx configuration file in there with another name. Use the ls command to check the files in there:
      ls -l /etc/nginx/sites-enabled/

    • @aslanhuseynov3481
      @aslanhuseynov3481 3 роки тому

      @@bobbyiliev_ Hello, yes i have a different nginx configuration file which I wanted to create a new project. but this file is not texted as you have. thank you for your answer. i will wait.

  • @mohamedaly9096
    @mohamedaly9096 2 роки тому

    well that's great. but i can't connect to the nginx this way, it there a way to do that on aws console?

  • @mananvirmani1243
    @mananvirmani1243 3 роки тому +1

    thanks for the video!! helped me a lot!!

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому +1

      Really happy to hear that it was helpful!

  • @Zylaqueza
    @Zylaqueza 3 роки тому

    I create my Wordpress site before for scratch. And a few weeks ago. I put some DNS in my ethernet section. There is no problem with that or i need to change what DNS I put ? I put only 1.1.1.1 and 1.0.0.1 for internet download speed purpose.
    And yesterday I see my Wordpress site exprncing 502 nginx error. Although my Wordpress version was old. I update it and all plugins. But instead I resolve my problem it's goes to Maintenance.

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      Hi there, the 502 error is not likely caused by the DNS change.
      I would recommend checking if the PHP FPM service is up and running on the server. If not make sure to start it.

  • @pravallikachevuru7145
    @pravallikachevuru7145 3 роки тому

    Hi please answer my question..
    Iam struggling from last week's.
    Iam using gke clustee, configured nginx ingress controller,
    2 applications are deployed to gke container ports are for http: 8081, https: 8088, I have configured ingress rules but got 502 bad gate way.
    How to troubleshoot this?? How to start the backend service
    Helpme with this befor my manager fire me

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      Make sure to check your logs first to see the actual error. If the applications are deployed, make sure that the ports are actually exposed correctly and also make sure that the applications are running.

    • @pravallikachevuru7145
      @pravallikachevuru7145 3 роки тому

      @@bobbyiliev_ I acn able to access the application with type load balancer. But iam unable to access to acces with ingress. I check the logs of ingress pod. It's showing the error as "http/1.1 connection refused while connecting to upstream"

  • @jothamsinyanya6954
    @jothamsinyanya6954 3 роки тому +1

    Thank you. This was very helpful.

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      No problem! Happy to hear that it helped!

  • @petergriffin8767
    @petergriffin8767 3 роки тому +1

    very helpful ty

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      No problem at all! Happy to hear that this helped!

  • @suneel1875
    @suneel1875 3 роки тому

    hello, what would you do for node js backend server?

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому +1

      Hi there, you would need to make sure that the Node js service is up and running. If it is not running you would need to check the logs and see why it has crashed.

    • @suneel1875
      @suneel1875 3 роки тому

      @@bobbyiliev_ I have posted the question in digital ocean. Waiting for your response :) www.digitalocean.com/community/questions/502-bad-gateaway-nginx

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому +1

      @@suneel1875 Hi there, just posted a reply 🙌

  • @mmusiphuti3261
    @mmusiphuti3261 2 роки тому +1

    very helpfull

  • @muskangupta1977
    @muskangupta1977 Рік тому

    Whaat is the equivalent cmd to docker ps -a for nodejs server

  • @princezzdaniella3348
    @princezzdaniella3348 2 роки тому

    I just got error bad gateway omg how do u fix that

    • @bobbyiliev_
      @bobbyiliev_  2 роки тому

      Best thing to do is to check your Nginx error log first to see the actual problem rather than the generic error:
      tail -100 /var/log/nginx/error.log

  • @jaybhatia5581
    @jaybhatia5581 3 роки тому

    Do i need to install docker 1st??

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      No, docker is just used as an example here. If you are running an app like Node.js or PHP FPM then you need to make sure that the application is started.

  • @AmerMaraqa
    @AmerMaraqa 3 роки тому

    Hello Thanks for the great video!
    }
    location @puma {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_pass 127.0.0.1:5000;
    }
    Im getting a service that is running on port 5000. I checked online and found that it is FLASK service that use by default port 5000. Do you have any idea how to restore it?
    Please notice that received this error on a SMTP server with postal application and nothing else installed.
    Any ideas on what to do next ? Thank you

    • @bobbyiliev_
      @bobbyiliev_  2 роки тому +1

      Hi there, as far as I can see form the config it looks like that the backend service is puma. It would depend on how puma is setup, but if there is a systemd service for it you could start it with: systemctl restart puma

  • @awetinodaily7084
    @awetinodaily7084 3 роки тому

    How can i came to this page

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      Hi there, You would need to first SSH to the server.

  • @noetim1284
    @noetim1284 3 роки тому

    I DONT HAVE A DOCKER ID. tf im supposed to do now

    • @bobbyiliev_
      @bobbyiliev_  3 роки тому

      You need to start your backend service. In the video I mention that it is not necessarily docker. What is the proxy rule in your Nginx server block?

  • @jp_doner
    @jp_doner 2 роки тому

    Not useful at all

    • @bobbyiliev_
      @bobbyiliev_  Рік тому

      Sorry to hear that, feel free to share more details about your problem and I will be happy to advise you further!

  • @maryamalmutairi1797
    @maryamalmutairi1797 2 роки тому

    i have the same port in the container and nginx.conf so what to do ? its still show me bad getway

    • @bobbyiliev_
      @bobbyiliev_  Рік тому

      What do you see in your error logs?