Websites are down: 502 Bad Gateway

Created:

2017-06-17 18:19:07 UTC

Modified:

2017-08-08 13:19:05 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Websites are down: 502 Bad Gateway

Symptoms

  • Websites are down:

    502 Bad Gateway
  • On attempt to start Apache service at Plesk > Tools & Settings > Services management, the following error is shown:

    Details: [2017-06-17 19:45:38] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/apache_control_adapter' '--restart' '--restart-interval' '0' '--http-port' '7080' '--https-port' '7081'] with exit code [255] 
    Error occured while sending feedback. HTTP code returned: 502
    [2017-06-17 19:46:10] ERR [panel] Apache config (14977213910.06429100) generation failed: Template_Exception: Can not restart web server:
    file: /opt/psa/admin/plib/Service/Driver/Web/Server/Apache.php<br />
    line: 108
    code: 0
    plesk sendmail[4623]: Unable to resolve fqdn: Name or service not known
    plesk sendmail[4623]: It is impossible to detect the FQDN of the host.
    Please make sure that the host name is correctly specified in /etc/hosts and goes right after the host&#039;s IP address.
    Depending on your OS, you might need to set the host name in /etc/HOSTNAME or /etc/hostname.
    plesk sendmail[4623]: Unable to retrieve hostname. Use localhost.localdomain instead.
    Error occured while sending feedback. HTTP code returned: 502
    Can not restart web server:
  • The following error can be found in the apache.log file:

    # grep FQDN /var/log/apache2/error.log
    
    plesk sendmail[25190]: It is impossible to detect the FQDN of the host.
  • The file /etc/hosts does not contain a server IP address and a hostname:

    # cat /etc/hosts
    127.0.0.1 localhost
    ::1 ip6-localhost ip6-loopback

Cause

The hostname is not specified or specified incorrectly in the file /etc/hosts.

Resolution

Add a server IP address and a hostname to the file /etc/hosts:

  1. Find out the server IP address:

    # ip a | grep eth0
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 203.0.113.2/32 brd 203.0.113.2 scope global eth0
  2. Find out the hostname:

    # hostname
    server.example.com
  3. Add 

    # cat /etc/hosts
    127.0.0.1 localhost
    ::1 ip6-localhost ip6-loopback
    203.0.113.2 server.example.com server
Have more questions? Submit a request
Please sign in to leave a comment.