Websites show 502 Bad Gateway after enabling nginx on a server with Fail2ban




  • Avatar
    Olosz Andor

    This solution is worked for me (Plesk 17.0.17)

    Thank you! :)

  • Avatar

    did not help

  • Avatar
    Pavel Mikhaylov

    Hello iamkingsleyf,

    Could you clarify a few moments, please:

    1. Did the symptoms match entirely to ones you were having? 502 error is quite general and solutions may vary, depending on the additional symptoms.
    2. Does the issue still persist or did you manage to resolve it by other means?

    If the issue is not resolved, I would like to recommend to contact our support:

  • Avatar
    Unknown User

    I have this problem in my server, The bug have not fixed.

    However, I add my server IP to trusted IP list, That is ok, now.

    Here is my server information

    OS CentOS Linux 7.4.1708 (Core)
    Product Plesk Onyx
    Version 17.5.3 Update #45, last updated on April 16, 2018 10:36 AM
  • Avatar
    Pavel Mikhaylov

    Hello Lok Ming Chu,

    As the article states:

    Note: Even if the latest micro update of Plesk 17.5 is installed, the issue may persist if fail2ban and IP addresses were configured on the server before 19 MU. In this case, apply the 1st and 2nd steps.

    If this is the case, you have applied the correct solution.


  • Avatar
    Parahoster / Thibaut Robert


    j'ai cette erreur
    Réorientation / bin / systemctl redémarrer iptables.service
    Job pour iptables.service a échoué parce que le processus de commande est sorti avec le code d'erreur. Voir « état systemctl iptables.service » et « journalctl -xe » pour plus de détails.

    I don't understand

  • Avatar
    Alisa Kasyanova

    @Parahoster / Thibaut Robert
    Such error means that iptables service was not restarted properly: it ended up in some error. Check the "service iptables status" output for more information on the cause

  • Avatar

    I find nginx-botsearch.conf and nginx-http-auth in /usr/share/doc/fail2ban/dist-config

    How can I do to run this jails in my plesk server,
    Can you help me with files to modify o create?

    Thank you

  • Avatar
    Alisa Kasyanova

    You may do this:
    cp -a /usr/share/doc/fail2ban-0.9.6/dist-config/filter.d/nginx-botsearch.conf /etc/fail2ban/filter.d/
    After that, the jail appears in Plesk.
    Or you may refer to this article for detailed steps on how to do it via Plesk interface:

  • Avatar

    Thank you Aliza

    I´ve also follow with your comment this link and has been helpful

    and it seems work !


    2019-02-05 00:42:36,070 fail2ban.actions        [22701]: NOTICE  [nginx-noscript] Ban
    2019-02-05 00:42:36,071 fail2ban.filter [22701]: INFO [recidive] Found
    2019-02-05 00:42:46,512 fail2ban.filter [22701]: INFO [plesk-wordpress] Found
    2019-02-05 00:42:48,622 fail2ban.filter [22701]: INFO [plesk-wordpress] Found
    2019-02-05 00:42:49,285 fail2ban.actions [22701]: NOTICE [plesk-wordpress] Ban
    2019-02-05 00:42:49,289 fail2ban.filter [22701]: INFO [recidive] Found
    2019-02-05 00:44:25,948 fail2ban.filter [22701]: INFO [plesk-apache] Found
    2019-02-05 00:44:25,950 fail2ban.filter [22701]: INFO [plesk-apache] Found
    2019-02-05 00:44:26,539 fail2ban.actions [22701]: NOTICE [plesk-apache] Ban
    2019-02-05 00:44:26,543 fail2ban.filter [22701]: INFO [recidive] Found
    2019-02-05 00:46:05,143 fail2ban.filter [22701]: INFO [nginx-noscript] Found
    2019-02-05 00:46:05,504 fail2ban.actions [22701]: NOTICE [nginx-noscript] Ban
    2019-02-05 00:46:05,505 fail2ban.filter [22701]: INFO [recidive] Found
    2019-02-05 00:47:03,516 fail2ban.filter [22701]: INFO [plesk-apache] Found
    2019-02-05 00:51:44,650 fail2ban.filter [22701]: INFO [nginx-noscript] Found
    2019-02-05 00:51:45,080 fail2ban.actions [22701]: NOTICE [nginx-noscript] Ban
    2019-02-05 00:51:45,084 fail2ban.filter [22701]: INFO [recidive] Found 

    I took advantage to configure other jails !


    Thank you again!


  • Avatar
    Alisa Kasyanova

    Glad to know that it helped! Thank you for the link as well, I think that it can be helpful for other Pleskians as well.

Please sign in to leave a comment.

Have more questions? Submit a request