Solve [error] 28901#0: *401 upstream sent too big header while reading response header from upstream

Today I got this 502 error on my websites :

1
Solve [error] 28901#0: *401 upstream sent too big header while reading response header from upstream, client: 116.86.214.27, server: yodi.biz, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "yodi.biz"

After looking at NGINX documentation, i found the problem in my fastcgi buffers. So, the solution is just open /etc/nginx/nginx.conf and on “http” part, put this :

1
2
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;

If you still get 502 upstream sent too big header, then try to increase the fastcgi buffers :)

How to install and uninstall sphinx search from source in Ubuntu

Instead using synaptic and install sphinxsearch deb package, we also can use the source. First, you should download source package from the sphinxsearch website http://sphinxsearch.com/downloads/.

At this example, I use sphinx-2.0.4-release.tar.gz. I use Ubuntu 12.04 Precise. Then you can extract it and start compiling. Here are the steps to do :

1
2
3
4
5
6
sudo apt-get install build-essential libmysql++-dev libmysqlclient18-dev
tar -xvvf sphinx-2.0.4-release.tar.gz
cd sphinx-2.0.4-release
./configure --with-mysql
make
sudo make install

It will installed in /usr/local. For sphinx.conf, you can create it at /usr/local/etc.

If you need to uninstall sphinx search from source, then just go to previous folder (sphinx-2.0.4-release) and do :

1
sudo make uninstall

Delete git branch both remote and local

There are simple way to delete git branch locally and remote.
But first thing to do, you should move from branch that you will delete.
Just checkout master or development branch and start removing git branch.

1
2
3
git checkout <not-branch-name>
git branch -D <branch-name>
git push origin :<branch-name>

To create new github branch that clone from another branch and checkout automatically :

1
2
git checkout -b <new-branch>
git push origin <new-branch>

Simple!

NGINX *1 upstream sent too big header while reading response header from upstream

When I login into WordPress Administration page, I got it blank pages. Curious about what happend, I go through into NGINX error.log and I see this error :

1
*1 upstream sent too big header while reading response header from upstream

Then to solve this problem, I need to add “fastcgi_buffers 8 256k;” and “fastcgi_buffer_size 128k;” this into my nginx hosts :
Continue reading

Solve recv() failed (104: Connection reset by peer) 502 NGINX Bad Gateway PHP5 FPM

When I host many wordpress sites under NGINX + PHP5-FPM on Ubuntu Oneiric, everything is smooth and there no problem. Suddenly, after a few month, I got error NGINX 502 Gateway on my cron. Then after dive into NGINX error.log, I see this error :

1
2
2012/03/19 14:20:21 [error] 2383#0: *334 readv() failed (104: Connection reset by peer) while reading upstream, client: 199....., server: www.clipsta.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.clipsta.com"
2012/03/19 14:21:18 [error] 2899#0: *19 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.2..., server: www.clipsta.com, request: "GET /wp-cron.php?doing_wp_cron HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.clipsta.com"

Continue reading

Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

Do you got several error message like this ?

1
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

Or

1
[ERROR] /usr/sbin/mysqld: Incorrect key file for try to repair it

Or maybe :

1
sudo service mysql start start: Job failed to start

Continue reading

Solve Uncaught exception ‘Zend_Json_Exception’ with message ‘Decoding failed: Syntax error

Using Zend_JSON for parse invalid JSON format like “pain in the neck”. If you got this kind of error while parse JSON :

1
Uncaught exception 'Zend_Json_Exception' with message 'Decoding failed: Syntax error

Or maybe :

1
Uncaught exception 'Zend_Json_Exception' with message 'Decoding failed: Unexpected control character found

I suggest to you, move into json_decode() from native PHP. Here are snippets to handle JSON invalid format exception.
Continue reading

How to Virtualbox Guest share wireless connection from host Ubuntu

I usually use LAN cable and share internet connection using NAT to Virtualbox client. But, I need to connect using Wireless int my Host and found NAT can’t works through this connection. So, share internet connection from wireless to Virtualbox guest, we should use “bridge-network”.

Go Virtualbox Client Settings -> Network -> Bridge network and choose your wireless devices.
Then start your Virtual Machine and set cable connected on network icon.