Nginx 502 Bad Gateway after restartHow to get access from nginx on host OS to files inside lxc-container?502 Bad Gateway nginx php7 fpmNginx - 502 bad gateway502 bad gateway nginx php7.0-pfm ubuntu 16.04Nginx 502 bad gatewayGet Apache2 running with nginx as reverse proxyNginx failing to redirect to docker containernginx 502 bad gateway for 1 minute after restartnginx : websocket failed to connect404 and 403 using nginx Pagekit php7.2-fpm

Identifying the interval from A♭ to D♯

Good allowance savings plan?

Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?

Is it normal that my co-workers at a fitness company criticize my food choices?

How Did the Space Junk Stay in Orbit in Wall-E?

Why do Australian milk farmers need to protest supermarkets' milk price?

Schematic conventions for different supply rails

Did CPM support custom hardware using device drivers?

What is a good source for large tables on the properties of water?

Bash replace string at multiple places in a file from command line

Life insurance that covers only simultaneous/dual deaths

An Accountant Seeks the Help of a Mathematician

Using "wallow" verb with object

Pinhole Camera with Instant Film

Why would a flight no longer considered airworthy be redirected like this?

Theorems like the Lovász Local Lemma?

Why must traveling waves have the same amplitude to form a standing wave?

Why do passenger jet manufacturers design their planes with stall prevention systems?

How is the Swiss post e-voting system supposed to work, and how was it wrong?

Can hydraulic brake levers get hot when brakes overheat?

Professor being mistaken for a grad student

Why is stat::st_size 0 for devices but at the same time lseek defines the device size correctly?

Official degrees of earth’s rotation per day

Can elves maintain concentration in a trance?



Nginx 502 Bad Gateway after restart


How to get access from nginx on host OS to files inside lxc-container?502 Bad Gateway nginx php7 fpmNginx - 502 bad gateway502 bad gateway nginx php7.0-pfm ubuntu 16.04Nginx 502 bad gatewayGet Apache2 running with nginx as reverse proxyNginx failing to redirect to docker containernginx 502 bad gateway for 1 minute after restartnginx : websocket failed to connect404 and 403 using nginx Pagekit php7.2-fpm













1















I've just taken over management of a server that a previous staff member set up. It's an Ubuntu 16.04.3 LTS server which is used purely as a SVN server for some legacy code (running on AWS).



It's running nginx and usually we can access in a browser the url https://mysvn.com and get a page that just states "It works!".



I recently patched the server with latest updates and after rebooting, I was getting a 502 Bad Gateway message in the browser. But the strange thing is, I created an attached new volumes using the most recent snapshots, and the problem still persists. So I guess this is not caused by the patching, but rather something about the nginx config that can't handle the reboot.



Unfortunately I don't know enough about nginx to see what's wrong with the config.



The error message in the logs is:



2018/01/08 09:35:05 [error] 10387#10387: *162 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XXX.XX, server: mysvn.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "mysvn.com"


The code from the file in /etc/nginx/sites-available is this:



server 
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;

server_name mysvn.com;

location /.well-known
alias /var/www/html/.well-known;



server
listen 443 ssl;
server_name mysvn.com;
ssl_certificate /home/jenkins/.acme.sh/mysvn.com/mysvn.com.cer;
ssl_certificate_key /home/jenkins/.acme.sh/mysvn.com/mysvn.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_dhparam /etc/ssl/certs/dhparam.pem;

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

location /
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
proxy_pass http://localhost:8080/;

client_max_body_size 200M;




Is there any way to find more information about what is causing the error?










share|improve this question




























    1















    I've just taken over management of a server that a previous staff member set up. It's an Ubuntu 16.04.3 LTS server which is used purely as a SVN server for some legacy code (running on AWS).



    It's running nginx and usually we can access in a browser the url https://mysvn.com and get a page that just states "It works!".



    I recently patched the server with latest updates and after rebooting, I was getting a 502 Bad Gateway message in the browser. But the strange thing is, I created an attached new volumes using the most recent snapshots, and the problem still persists. So I guess this is not caused by the patching, but rather something about the nginx config that can't handle the reboot.



    Unfortunately I don't know enough about nginx to see what's wrong with the config.



    The error message in the logs is:



    2018/01/08 09:35:05 [error] 10387#10387: *162 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XXX.XX, server: mysvn.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "mysvn.com"


    The code from the file in /etc/nginx/sites-available is this:



    server 
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html;

    server_name mysvn.com;

    location /.well-known
    alias /var/www/html/.well-known;



    server
    listen 443 ssl;
    server_name mysvn.com;
    ssl_certificate /home/jenkins/.acme.sh/mysvn.com/mysvn.com.cer;
    ssl_certificate_key /home/jenkins/.acme.sh/mysvn.com/mysvn.com.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
    ssl_dhparam /etc/ssl/certs/dhparam.pem;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    location /
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    # try_files $uri $uri/ =404;
    proxy_pass http://localhost:8080/;

    client_max_body_size 200M;




    Is there any way to find more information about what is causing the error?










    share|improve this question


























      1












      1








      1








      I've just taken over management of a server that a previous staff member set up. It's an Ubuntu 16.04.3 LTS server which is used purely as a SVN server for some legacy code (running on AWS).



      It's running nginx and usually we can access in a browser the url https://mysvn.com and get a page that just states "It works!".



      I recently patched the server with latest updates and after rebooting, I was getting a 502 Bad Gateway message in the browser. But the strange thing is, I created an attached new volumes using the most recent snapshots, and the problem still persists. So I guess this is not caused by the patching, but rather something about the nginx config that can't handle the reboot.



      Unfortunately I don't know enough about nginx to see what's wrong with the config.



      The error message in the logs is:



      2018/01/08 09:35:05 [error] 10387#10387: *162 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XXX.XX, server: mysvn.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "mysvn.com"


      The code from the file in /etc/nginx/sites-available is this:



      server 
      listen 80 default_server;
      listen [::]:80 default_server;
      root /var/www/html;

      server_name mysvn.com;

      location /.well-known
      alias /var/www/html/.well-known;



      server
      listen 443 ssl;
      server_name mysvn.com;
      ssl_certificate /home/jenkins/.acme.sh/mysvn.com/mysvn.com.cer;
      ssl_certificate_key /home/jenkins/.acme.sh/mysvn.com/mysvn.com.key;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
      ssl_dhparam /etc/ssl/certs/dhparam.pem;

      root /var/www/html;

      # Add index.php to the list if you are using PHP
      index index.html index.htm index.nginx-debian.html;

      location /
      # First attempt to serve request as file, then
      # as directory, then fall back to displaying a 404.
      # try_files $uri $uri/ =404;
      proxy_pass http://localhost:8080/;

      client_max_body_size 200M;




      Is there any way to find more information about what is causing the error?










      share|improve this question
















      I've just taken over management of a server that a previous staff member set up. It's an Ubuntu 16.04.3 LTS server which is used purely as a SVN server for some legacy code (running on AWS).



      It's running nginx and usually we can access in a browser the url https://mysvn.com and get a page that just states "It works!".



      I recently patched the server with latest updates and after rebooting, I was getting a 502 Bad Gateway message in the browser. But the strange thing is, I created an attached new volumes using the most recent snapshots, and the problem still persists. So I guess this is not caused by the patching, but rather something about the nginx config that can't handle the reboot.



      Unfortunately I don't know enough about nginx to see what's wrong with the config.



      The error message in the logs is:



      2018/01/08 09:35:05 [error] 10387#10387: *162 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XXX.XX, server: mysvn.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "mysvn.com"


      The code from the file in /etc/nginx/sites-available is this:



      server 
      listen 80 default_server;
      listen [::]:80 default_server;
      root /var/www/html;

      server_name mysvn.com;

      location /.well-known
      alias /var/www/html/.well-known;



      server
      listen 443 ssl;
      server_name mysvn.com;
      ssl_certificate /home/jenkins/.acme.sh/mysvn.com/mysvn.com.cer;
      ssl_certificate_key /home/jenkins/.acme.sh/mysvn.com/mysvn.com.key;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
      ssl_dhparam /etc/ssl/certs/dhparam.pem;

      root /var/www/html;

      # Add index.php to the list if you are using PHP
      index index.html index.htm index.nginx-debian.html;

      location /
      # First attempt to serve request as file, then
      # as directory, then fall back to displaying a 404.
      # try_files $uri $uri/ =404;
      proxy_pass http://localhost:8080/;

      client_max_body_size 200M;




      Is there any way to find more information about what is causing the error?







      nginx webserver






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 3 hours ago







      shaneoh

















      asked Jan 8 '18 at 9:39









      shaneohshaneoh

      5227




      5227




















          1 Answer
          1






          active

          oldest

          votes


















          1














          I'm not sure that this topic is for askubuntu.com, but will try to answer it.



          You have proxy_pass http://localhost:8080/; which is something that nginx expects to work and proxy all the requests there.
          Maybe you have apache too and its not running after the servers reboot.



          Try start it using : service apache2 start and see if you have "It works!" page!






          share|improve this answer























          • Sometimes it's a bit unclear to me which site is the best for a particular question - apologies if I got this one wrong. In any case though, apache isn't installed on this server at all.

            – shaneoh
            Jan 8 '18 at 11:24











          • So you look for which application uses port 8080. In your configuration Nginx waits for port 8080 to be opened, and if its not, it gives you "bad gateway". Hope this helps you

            – Nikolay Nikolov
            Jan 8 '18 at 11:43











          • I eventually discovered that apache was running inside a docker container and getting this container running was the issue.

            – shaneoh
            Jan 8 '18 at 12:19










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f993486%2fnginx-502-bad-gateway-after-restart%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          I'm not sure that this topic is for askubuntu.com, but will try to answer it.



          You have proxy_pass http://localhost:8080/; which is something that nginx expects to work and proxy all the requests there.
          Maybe you have apache too and its not running after the servers reboot.



          Try start it using : service apache2 start and see if you have "It works!" page!






          share|improve this answer























          • Sometimes it's a bit unclear to me which site is the best for a particular question - apologies if I got this one wrong. In any case though, apache isn't installed on this server at all.

            – shaneoh
            Jan 8 '18 at 11:24











          • So you look for which application uses port 8080. In your configuration Nginx waits for port 8080 to be opened, and if its not, it gives you "bad gateway". Hope this helps you

            – Nikolay Nikolov
            Jan 8 '18 at 11:43











          • I eventually discovered that apache was running inside a docker container and getting this container running was the issue.

            – shaneoh
            Jan 8 '18 at 12:19















          1














          I'm not sure that this topic is for askubuntu.com, but will try to answer it.



          You have proxy_pass http://localhost:8080/; which is something that nginx expects to work and proxy all the requests there.
          Maybe you have apache too and its not running after the servers reboot.



          Try start it using : service apache2 start and see if you have "It works!" page!






          share|improve this answer























          • Sometimes it's a bit unclear to me which site is the best for a particular question - apologies if I got this one wrong. In any case though, apache isn't installed on this server at all.

            – shaneoh
            Jan 8 '18 at 11:24











          • So you look for which application uses port 8080. In your configuration Nginx waits for port 8080 to be opened, and if its not, it gives you "bad gateway". Hope this helps you

            – Nikolay Nikolov
            Jan 8 '18 at 11:43











          • I eventually discovered that apache was running inside a docker container and getting this container running was the issue.

            – shaneoh
            Jan 8 '18 at 12:19













          1












          1








          1







          I'm not sure that this topic is for askubuntu.com, but will try to answer it.



          You have proxy_pass http://localhost:8080/; which is something that nginx expects to work and proxy all the requests there.
          Maybe you have apache too and its not running after the servers reboot.



          Try start it using : service apache2 start and see if you have "It works!" page!






          share|improve this answer













          I'm not sure that this topic is for askubuntu.com, but will try to answer it.



          You have proxy_pass http://localhost:8080/; which is something that nginx expects to work and proxy all the requests there.
          Maybe you have apache too and its not running after the servers reboot.



          Try start it using : service apache2 start and see if you have "It works!" page!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 8 '18 at 11:12









          Nikolay NikolovNikolay Nikolov

          3,0111613




          3,0111613












          • Sometimes it's a bit unclear to me which site is the best for a particular question - apologies if I got this one wrong. In any case though, apache isn't installed on this server at all.

            – shaneoh
            Jan 8 '18 at 11:24











          • So you look for which application uses port 8080. In your configuration Nginx waits for port 8080 to be opened, and if its not, it gives you "bad gateway". Hope this helps you

            – Nikolay Nikolov
            Jan 8 '18 at 11:43











          • I eventually discovered that apache was running inside a docker container and getting this container running was the issue.

            – shaneoh
            Jan 8 '18 at 12:19

















          • Sometimes it's a bit unclear to me which site is the best for a particular question - apologies if I got this one wrong. In any case though, apache isn't installed on this server at all.

            – shaneoh
            Jan 8 '18 at 11:24











          • So you look for which application uses port 8080. In your configuration Nginx waits for port 8080 to be opened, and if its not, it gives you "bad gateway". Hope this helps you

            – Nikolay Nikolov
            Jan 8 '18 at 11:43











          • I eventually discovered that apache was running inside a docker container and getting this container running was the issue.

            – shaneoh
            Jan 8 '18 at 12:19
















          Sometimes it's a bit unclear to me which site is the best for a particular question - apologies if I got this one wrong. In any case though, apache isn't installed on this server at all.

          – shaneoh
          Jan 8 '18 at 11:24





          Sometimes it's a bit unclear to me which site is the best for a particular question - apologies if I got this one wrong. In any case though, apache isn't installed on this server at all.

          – shaneoh
          Jan 8 '18 at 11:24













          So you look for which application uses port 8080. In your configuration Nginx waits for port 8080 to be opened, and if its not, it gives you "bad gateway". Hope this helps you

          – Nikolay Nikolov
          Jan 8 '18 at 11:43





          So you look for which application uses port 8080. In your configuration Nginx waits for port 8080 to be opened, and if its not, it gives you "bad gateway". Hope this helps you

          – Nikolay Nikolov
          Jan 8 '18 at 11:43













          I eventually discovered that apache was running inside a docker container and getting this container running was the issue.

          – shaneoh
          Jan 8 '18 at 12:19





          I eventually discovered that apache was running inside a docker container and getting this container running was the issue.

          – shaneoh
          Jan 8 '18 at 12:19

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f993486%2fnginx-502-bad-gateway-after-restart%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Are there any comparative studies done between Ashtavakra Gita and Buddhim?How is it wrong to believe that a self exists, or that it doesn't?Can you criticise or improve Ven. Bodhi's description of MahayanaWas the doctrine of 'Anatta', accepted as doctrine by modern Buddhism, actually taught by the Buddha?Relationship between Buddhism, Hinduism and Yoga?Comparison of Nirvana, Tao and Brahman/AtmaIs there a distinction between “ego identity” and “craving/hating”?Are there many differences between Taoism and Buddhism?Loss of “faith” in buddhismSimilarity between creation in Abrahamic religions and beginning of life in Earth mentioned Agganna Sutta?Are there studies about the difference between meditating in the morning versus in the evening?Can one follow Hinduism and Buddhism at the same time?Are there any prohibitions on participating in other religion's practices?Psychology of 'flow'

          Where else does the Shulchan Aruch quote an authority by name?Parashat Metzora+HagadolPesach/PassoverShulchan Aruch UTF-8Anonymous glosses in the Shulchan AruchWhy is the Shulchan Aruch definitive?Siman 32, Kitzur Shulchan Aruch: UntranslatedLitvaks/Yeshivish and Shulchan AruchBuying a Shulchan AruchEnglish version of SHULCHAN ARUCHIs there any place where Shulchan Aruch rules with the Rosh against the Rif and Rambam?Are there practices where Sepharadim do not hold by Shulchan Aruch?5th part of the shulchan aruch

          fallocate: fallocate failed: Text file busy in Ubuntu 17.04? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)defragmenting and increasing performance of old lubuntu system with swap partitionIssue with increasing the root partition from the swapthis /usr/bin/dpkg returned error || ubuntu-16.04, 64bitDefault 17.04 swap file locationHow to Resize Ubuntu 17.04 Zesty Swap file size?Ubuntu freezes from online formsMy Laptop is not starting after upgrade ubuntu 16.04 (Kernel 4.8.0-38 to 04.10.0-36)hcp: ERROR: FALLOCATE FAILED!Not sure my swap is being usedWine 3.0 asking for more virtual free swap