Force a logout shortcut, in Ubuntu

If everything is blocked / freezed, you can try this:

CTRL + ALT + F2

After this, you will be asked for your username and password to login. Type them then type this:

$ killall -u  [your-username] gnome-session

That’s it. Of course all your unsaved data is lost !

Nginx – upstream sent too big header while reading response header – solution

If you get this kind of error in your nginx logs:

ERROR: *1754 upstream sent too big header while reading response header from upstream, client: X.X.X.X, server: XXXX

One solution that worked for me, was to set the fastcgi_buffers and fastcgi_buffers_size in nginx configuration file:

$ vim /etc/nginx/nginx.conf

Add the following params to your nginx configuration file:

    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;

Restart nginx:

$ /etc/init.d/nginx restart

* This helped you ? Please share.

Installing Redis + Php Redis Extension + igbinary in Ubuntu 12.04

This is a quick example of how to install Redis server, Redis PHP extension + Igbinary in Ubuntu 12.04. All steps requires sudo access.

1. Install Redis server

Because the official Ubuntu PPA is not updated with the latest version of Redis, we need to add another repository:

$ sudo add-apt-repository ppa:chris-lea/redis-server
$ sudo apt-get update
$ sudo apt-get install redis-server

If “add-apt-repository” fails, try to run this first:

$ sudo apt-get install python-software-properties

2. Install igbinary

$ sudo pecl install igbinary

3. Install PHP Redis extension

$ cd
$ git clone https://github.com/nicolasff/phpredis.git
$ cd phpredis
$ phpize
$ ./configure --enable-redis-igbinary
$ sudo su
$ make && make install

There is a repository that has the php redis helper: https://github.com/ukko/phpredis-phpdoc

Hope this was heplful 🙂

Ubuntu server network problems – network down after reboot

I’ve experimented a strange situations a few days ago. After a few updates, my VPS became unreachable. Ifup command was throwing me errors – directory “/var/run/network” does not exists. After a few hours of researches, it seems that this is a problem that was solved back in 2008. Unfortunately, for some reasons – most probably because of updates the problem is back and i have no idea how to fix it – i’m not an expert. But, i tried the following thing that it’s working for me.

1. Create a .sh file with the following contents. Let’s name it network_check.sh

[prettify class=”bash”]

if [ ! -d “/var/run/network” ]; then

mkdir -p /var/run/network

sudo /etc/init.d/networking restart

sudo /etc/init.d/ssh restart

fi

[/prettify]

2. Create a cron to execute the script

[prettify class=”bash”]

*/1 * * * * root sh /PATH-TO-SCRIPT/network_check.sh

[/prettify]

As u can see i run the script every minute. You can set as much time as u want, but i like to be up and running immediate after reboot . Hope it helps someone 🙂