Tag Archives: debian

502 Bad Gateway – Nginx and PHP-FPM

Nginx 502 Bad Gateway cost me more time than the actual Ubuntu + PHP-FPM + MySQL installation I was working on. In my case the 502 Bad Gateway error on my installation was the result of a parameter mismatch between /etc/ningx/sites-available/default and /etc/php5/fpm/pool.d/www.conf.

In order to solve the 502 Bad Gateway problem edit the Nginx file /etc/ningx/sites-available/default.

nano /etc/ningx/sites-available/default

And look for the commented line # fastcgi_pass unix:/var/run/php5-fpm.sock; and uncomment the line.

fastcgi_pass unix:/var/run/php5-fpm.sock;

You location ~ .php$ { section should look similar to mine.

 location ~ .php$ {
                fastcgi_split_path_info ^(.+.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }

The final two steps are to restart Nginx and PHP-FPM.

sudo service nginx restart
sudo service php5-fpm restart

Now you have a working installation like it should have been from the beginning.

Increase Console Resolution In Ubuntu

Higher resolution means more text in the same window this especially applies to the console. The following was tested in Debian 7 Wheezy and Ubuntu 13.04. With Grub 2 with can easily increase the resolution by making a few changes.

Console Resolution

Open and edit the grub file.

nano /etc/default/grub

Search for the following line and uncomment “#GRUB_GFXMODE=640“, modify it to include a higher resolution such as 1440×900. Also add the line “GRUB_GFXPAYLOAD_LINUX=keep“.

GRUB_GFXMODE=1440X900
GRUB_GFXPAYLOAD_LINUX=keep

The lines above should be what increases the console resolution.

Now update Grub.

sudo update-grub

And restart the system.

sudo shutdown -r now

Now you should be able to make better use of your monitor resolution.

HTOP 1440x900

SSH Permission Denied (publickey)

Had a peculiar problem last week where the computer at home I use to pull backups from a remote VPS could not longer SSH into the remote system.

user@deb7h:~$ ./vps-01-backup-www.sh
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(605) [Receiver=3.0.9]

After looking at directory permissions on both systems and user credentials as the possible source of the problem I came across this post where it recommends that permission for the private key file be set to 600.

chmod 600 ~/.ssh/id_rsa

The change in permission worked, perhaps the file had too high of a permission number which in not allowed.

As to how this happen I have no idea, but I probably must have carelessly changed the permission at some point. This happen in a Debian Wheezy system.