Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    502 Bad Gateway, nginx

    Scheduled Pinned Locked Moved General pfSense Questions
    27 Posts 5 Posters 12.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stephenw10S
      stephenw10 Netgate Administrator
      last edited by

      Hmm, odd. We don't really see that in 2.7.2 any longer. I used to be a much bigger issue. It pretty much always implies some php process running away though.

      1 Reply Last reply Reply Quote 0
      • V
        vector88
        last edited by vector88

        Hello @stephenw10 and everyone.

        I've recently installed Pfsense 2.7.2 and kept on getting bad gateway 502.

        while troubleshooting I tried reverting back to 2.7.0 and after doing so, my pfsense IP no longer gave me 502, but after updating again to 2.7.2 i kept getting 502.

        I tried restarting php-fpm and it loads webgui before it says 502 again.

        I reverted to 2.7.0 and webgui is now working again.

        The only problem I have is I'm unable to use pkg manager due to version mismatch :(

        Can anyone help?

        Thanks everyone,
        Vector

        1 Reply Last reply Reply Quote 0
        • stephenw10S
          stephenw10 Netgate Administrator
          last edited by

          If you see 502 errors it's almost always because php failed for some reason. You should see something logged.

          V 1 Reply Last reply Reply Quote 0
          • V
            vector88 @stephenw10
            last edited by

            @stephenw10
            I do see things get logged after accessing: tail -f /var/log/system_general.log

            It says: "[ERROR] 556088#100299 *88 connect () to unix: var/run/php-fpm.socket failed (61: connection refused) while connecting to upstream, cleint: [PFSENSE IP] server:

            And while running tail netstat -an | grep LISTEN
            It listens on 127.0.0.1.953.

            Would you please help?

            1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              But nothing in the main system log?

              How is it configured? What are you running on?

              V 1 Reply Last reply Reply Quote 0
              • V
                vector88 @stephenw10
                last edited by

                @stephenw10
                I'm sorry, I'm a beginner.

                Would you please explain further?

                1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  I mean a basic 2.7.2 install will run without php issues. So what configuration have to done to yours. Something there is causing it a problem. Maybe some package you added is exhausting the RAM for example.

                  V 1 Reply Last reply Reply Quote 0
                  • V
                    vector88 @stephenw10
                    last edited by vector88

                    @stephenw10
                    I get your point; however, this issue occurs as soon as I do a clean install of 2.7.2
                    Without changing anything in the configuration at all.

                    I just set the IPs and the interfaces. pfsense WAN: 192.168.1.10 ISP router: 192.168.1.1 Pfsense LAN : 10.27.27.1

                    **Edit

                    I didn't add any packages and I have 16GB of RAM

                    V stephenw10S 2 Replies Last reply Reply Quote 0
                    • stephenw10S
                      stephenw10 Netgate Administrator
                      last edited by

                      Hmm, odd. What hardware is it installed on?

                      You are connecting to it from a client on the LAN?

                      1 Reply Last reply Reply Quote 0
                      • V
                        vector88 @vector88
                        last edited by vector88

                        @vector88

                        It's on Dell Latitude 7490 i7-8650U CPU
                        And the installation was USB memstick.

                        Again, this issue only occurred on 2.7.2 and 2.7.1.
                        2.7.0 worked fine, and I had to update it because the package manager didn't work :(

                        Yes, the client is on the LAN but even when I try to access WebGui from the ISP's side it returns the same 502.

                        1 Reply Last reply Reply Quote 0
                        • stephenw10S
                          stephenw10 Netgate Administrator @vector88
                          last edited by

                          @vector88 said in 502 Bad Gateway, nginx:

                          this issue occurs as soon as I do a clean install of 2.7.2
                          Without changing anything in the configuration at all.

                          To be clear that's with the default config or after importing your config that works in 2.7.1?

                          V 1 Reply Last reply Reply Quote 0
                          • V
                            vector88 @stephenw10
                            last edited by

                            @stephenw10
                            Default config, just after assigning the WAN, LAN for Pfsense and connecting Pfsense LAN to a switch and an ethernet from the switch directly into my laptop and then 502 everywhere.

                            1 Reply Last reply Reply Quote 0
                            • stephenw10S
                              stephenw10 Netgate Administrator
                              last edited by

                              Does it allow you to connect at all? To complete the setup wizard even?

                              V 1 Reply Last reply Reply Quote 0
                              • V
                                vector88 @stephenw10
                                last edited by vector88

                                @stephenw10
                                Yes, just after going through the wizard, right after finishing and entering the same config on the wizard and finishing..... Reboots..... And then 502

                                1 Reply Last reply Reply Quote 0
                                • stephenw10S
                                  stephenw10 Netgate Administrator
                                  last edited by

                                  It shouldn't reboot after completing the wizard. Did you set some interface specific value?

                                  1 Reply Last reply Reply Quote 0
                                  • V
                                    vector88
                                    last edited by

                                    Yes it shouldn't reboot. But after finishing the wizard it does the same thing, I tried rebooting as an extra step

                                    1 Reply Last reply Reply Quote 0
                                    • stephenw10S
                                      stephenw10 Netgate Administrator
                                      last edited by

                                      Can we see the system logs covering time the wizard is run and immediately afterwards?

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post
                                      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.