D3c78f62820dbda5a95e9a8f8271b676767945fa
By:
joilson

502 bad gateway nginx

September 1, 2016 8.2k views
Linux Commands Ubuntu

Hello friends want a help from you! Because then I'm having a problem Error 502 Bad gateway always nginx. Everything was normal, but until now I still don't see a tutorial in 2016, which corresponds to it, but I think it's bug. Can someone help me

4 comments
  • Hi! Are there any errors in nginx's error log? What's the output of the following command?

    sudo tail -30 /var/log/nginx/error.log
    
  • Hello friend I have that! This command is not going "sudo tail -30 /var/log/nginx/error.log"

    2016/08/31 15:46:55 [emerg] 11039#11039: "fastcgireadtimeout" directive is duplicate in /etc/nginx/nginx.conf:45
    2016/08/31 17:01:32 [info] 12089#12089: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:113
    2016/08/31 17:01:32 [info] 12102#12102: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:113
    2016/08/31 17:03:07 [info] 27788#27788: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:113
    2016/08/31 17:03:07 [info] 27800#27800: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:113
    2016/08/31 17:12:06 [info] 28408#28408: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:113
    2016/08/31 17:12:06 [notice] 28416#28416: signal process started
    2016/08/31 17:15:14 [info] 28542#28542: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:109
    2016/08/31 17:26:35 [info] 29309#29309: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:109
    2016/08/31 17:26:35 [info] 29311#29311: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:109
    2016/08/31 17:26:35 [notice] 29331#29331: signal process started
    2016/08/31 17:27:43 [info] 29402#29402: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:109
    2016/08/31 17:27:44 [info] 29414#29414: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:109
    2016/08/31 20:36:18 [emerg] 31599#31599: "fastcgipass" directive is not allowed here in /etc/nginx/sites-enabled/default:52
    2016/08/31 21:00:24 [info] 31896#31896: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:109
    2016/08/31 21:03:34 [emerg] 32052#32052: unknown directive "..." in /etc/nginx/nginx.conf:13
    2016/08/31 21:14:28 [emerg] 32480#32480: "fastcgi
    buffers" directive is duplicate in /etc/nginx/conf.d/fastcgi.conf:6
    2016/08/31 21:15:47 [info] 464#464: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:110
    2016/08/31 21:15:47 [info] 495#495: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:110
    2016/08/31 21:34:35 [emerg] 700#700: "fastcgipass" directive is not allowed here in /etc/nginx/sites-enabled/default:52
    2016/08/31 21:43:07 [info] 902#902: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:110
    2016/08/31 21:52:30 [info] 1107#1107: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:110
    2016/08/31 21:58:42 [emerg] 1286#1286: "fastcgi
    readtimeout" directive is duplicate in /etc/nginx/conf.d/fastcgi.conf:10
    2016/08/31 21:59:54 [info] 1441#1441: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:110
    2016/08/31 23:11:12 [info] 2311#2311: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:109
    2016/08/31 23:20:58 [emerg] 2499#2499: "location" directive is not allowed here in /etc/nginx/nginx.conf:11
    2016/08/31 23:27:14 [info] 2636#2636: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:110
    2016/08/31 23:28:47 [info] 2770#2770: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:110
    2016/08/31 23:35:49 [emerg] 2830#2830: "location" directive is not allowed here in /etc/nginx/conf.d/xyz.conf:1
    2016/08/31 23:37:14 [info] 2951#2951: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:110
    2016/08/31 23:42:09 [emerg] 3201#3201: "location" directive is not allowed here in /etc/nginx/nginx.conf:31
    2016/09/01 00:00:46 [info] 3707#3707: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 00:03:42 [info] 3892#3892: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:15
    2016/09/01 00:03:42 [emerg] 3892#3892: "location" directive is not allowed here in /etc/nginx/nginx.conf:18
    2016/09/01 00:09:21 [emerg] 4120#4120: the shared memory zone "one" is already declared for a different use in /etc/nginx/nginx.conf:30
    2016/09/01 00:18:03 [emerg] 4388#4388: "access
    log" directive is not allowed here in /etc/nginx/nginx.conf:4
    2016/09/01 00:18:27 [emerg] 4514#4514: "accesslog" directive is not allowed here in /etc/nginx/nginx.conf:4
    2016/09/01 00:18:47 [info] 4639#4639: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:112
    2016/09/01 00:19:29 [emerg] 4802#4802: "access
    log" directive is not allowed here in /etc/nginx/nginx.conf:10
    2016/09/01 00:21:17 [info] 5054#5054: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:112
    2016/09/01 00:21:17 [emerg] 5054#5054: "accesslog" directive is not allowed here in /etc/nginx/nginx.conf:135
    2016/09/01 00:21:46 [info] 5209#5209: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:112
    2016/09/01 00:27:06 [info] 5423#5423: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:112
    2016/09/01 00:29:13 [info] 5597#5597: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:113
    2016/09/01 00:31:02 [emerg] 5765#5765: invalid number of arguments in "client
    bodybuffersize" directive in /etc/nginx/nginx.conf:25
    2016/09/01 00:35:33 [info] 5943#5943: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:114
    2016/09/01 00:43:42 [info] 6234#6234: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:114
    2016/09/01 01:35:29 [info] 7356#7356: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:114
    2016/09/01 01:39:10 [info] 7615#7615: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 01:44:52 [info] 7835#7835: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 02:00:09 [info] 2378#2378: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 02:12:18 [info] 2376#2376: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 02:37:35 [alert] 2472#2472: *59 open socket #18 left in connection 5
    2016/09/01 02:37:35 [alert] 2472#2472: aborting
    2016/09/01 02:38:53 [info] 2380#2380: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 02:44:46 [info] 4418#4418: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 02:44:49 [info] 4461#4461: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 02:44:49 [info] 4473#4473: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 02:49:46 [info] 4596#4596: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:111
    2016/09/01 02:49:46 [notice] 4604#4604: signal process started

  • Did you tried to test your nignx configuration, there could be some errors in it?
    It is done by executing

    • sudo nginx -t

    This command is used to run syntax check and tests on your nginx.conf.

    Correct output should be something like:

    Output of nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    
  • Hello friend a nginx is with normal setting, but I think that's a bug, because so far I haven't found anything that solves

Be the first one to answer this question.