Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx Error 522 Connection Timeout Cloudflare

Discussion in 'Nginx and PHP-FPM news & discussions' started by skringjer, Apr 26, 2019.

  1. skringjer

    skringjer Member

    78
    11
    8
    Apr 21, 2019
    Ratings:
    +14
    Local Time:
    1:59 PM
    Greetings everyone and @eva2000 , i hope all are fine and doing well. Today i enabled cloudflare on my site and added include /usr/local/nginx/conf/cloudflare.conf; this in my vhost domain.ssl.conf file and also added a cron job 23 */36 * * * /usr/local/src/centminmod/tools/csfcf.sh auto >/dev/null 2>&1

    But now i am getting http://prntscr.com/nh0k3q

    What am i doing wrong, can someone please help?
     
  2. eva2000

    eva2000 Administrator Staff Member

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    If you use a reverse proxy like Cloudflare, Sucuri, or Incapsula in front of Centmin Mod Nginx, you need to setup nginx realip to be passed onto Nginx.

    See Getting Started Guide step 5 and setting correct real ip via nginx module config at http://centminmod.com/nginx_configure_cloudflare.html. The tools/csfcf.sh cronjob helps maintain the whitelisted CSF Firewall IPs, but you still need to setup nginx realip in your nginx vhost.
     
  3. skringjer

    skringjer Member

    78
    11
    8
    Apr 21, 2019
    Ratings:
    +14
    Local Time:
    1:59 PM
    I read that guide including /usr/local/nginx/conf/cloudflare.conf; i already included this file in the nginx domains vhost isnt this correct? do i need to add the set_real_ip in the nginx vhost too?

    Sorry if i am bugging you, from the guide i have only missed this part For a typical reverse proxy i.e. haproxy load balancer which Centminmod.com site uses:

    set_real_ip_from yourreverseproxyip;
    real_ip_header X-Forwarded-For;

    Because i dont know if i should this or not.

    I first try my best to read forum threads and guides, so if that dosent help then i come here and make a tread.
     
  4. eva2000

    eva2000 Administrator Staff Member

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    if you set include file /usr/local/nginx/conf/cloudflare.conf in nginx vhost then you're ok
    Code (Text):
    include /usr/local/nginx/conf/cloudflare.conf;

    make sure to restart nginx afterwards though
    Code (Text):
    ngxrestart
     
  5. skringjer

    skringjer Member

    78
    11
    8
    Apr 21, 2019
    Ratings:
    +14
    Local Time:
    1:59 PM
    I think i did restart nginx, let me try again and see how it goes through
     
  6. skringjer

    skringjer Member

    78
    11
    8
    Apr 21, 2019
    Ratings:
    +14
    Local Time:
    1:59 PM
    I can confirm now that the issue has been fixed, i didnt restart nginx definitely that was the case. Thank you very much Eva, seeing the performance on a live site for the first time was really unbelievable,

    I thought there arent enough users online on the site and hence the site and server are performing outstanding but i had even more users than usual and really its like a huge huge difference

    I am upgraded from VestaCP, i wish i had know this platform earlier. Is there any thread / platform i can review centmin? would also love to contribute i just found the donations page.

    Thank you once again :)
     
    • Like Like x 1
  7. eva2000

    eva2000 Administrator Staff Member

    41,386
    9,297
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,261
    Local Time:
    6:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Glad to hear

    There's no real review thread/platform out there I know of ? But much appreciated donation wise :)
     
    • Like Like x 1