nginx 502 Bad Gateway

Solution to the nginx 502 Bad Gateway Error Message. mysql-bin files too large. Debugging & fixing the problem in my case.

502 Bad Gateway

nginx 502 Bad Gateway

I have received a 502 Bad Gateway Error from the nginx webserver on all of my websites. First step: figure out what the access.log and error.log file includes.

Disk space full

The error.log is showing multiple entries, that the disk space is full.

In my server is a 120GB SSD which is 100% used. With the du -sh command you can list the folders which eat all of the disk space.

Mysql-bin file size

Directory for directory was inspected and /var/lib/mysql/ was the problem. That directory includes about 100 different mysql-bin files, which are partly 1GB large.

Solution

After a bit of research what these files are needed for i found that article:

https://www.cyberciti.biz/faq/what-is-mysql-binary-log/

For replication purposes those files are generated. If you have a mysql master server you can mirror that data onto other satellites / nodes. In my case this wasn’t in use. Another purpose is that those files contain backups for data recovery. Because i have different cronjob scripts, which backup my mysql data onto an external drive, this wasn’t needed too.

Therefore i commented the replication feature out.

The mysql server had an issue to restart, because the disk was full. After the deletion of a couple mysql-bin files it worked perfectly. After that my websites were available again.

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Nach oben scrollen