in Personal

ubuntu upgrade from hardy to intrepid. nginx fails.

Last night I upgraded ubuntu server (hardy) to intrepid. Everything went except nginx failed to serve php pages. Basically all requests to my site got 502 BAD GATEWAY error. So I thought maybe i had to upgrade nginx to a newer version that might be compatible with intrepid.

But later I realized that I downloaded nginx source, compiled and installed it manually. So after getting nginx via aptitude was a big mistake.


First. my old nginx was still running. I found out that by looking at the log file:

2010/05/08 10:56:44 [emerg] 4990#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/05/08 10:56:44 [emerg] 4990#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/05/08 10:56:44 [emerg] 4990#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/05/08 10:56:44 [emerg] 4990#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/05/08 10:56:44 [emerg] 4990#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2010/05/08 10:56:44 [emerg] 4990#0: still could not bind()

So I decided to remove nginx pkg which was installed via aptitude. So it did work. And then made sure the running process of nginx is dead. I did that too.

After that, I was able to run nginx again. phew…

So I hit the site and bam, the site started loading. However, when I went to wordpress admin page, I found out that load-styles.php and load-script.php wouldn’t work. At first some googling, none of suggestions were not for my issue. I started looking at fastcgi from start again assuming there gotta be an issue with fastcgi on nginx ’cause that’s the only way nginx works with PHP.

I installed fastcgi pkg again

sudo aptitude install php5-cgi

done.

I checked config files again

vim /etc/default/php-fastcgi

done.

I checked start script again

vim /etc/init.d/php-fastcgi

done.

I started puzzling why the hell there are two different fastcgi conf files at /usr/local/ngixnx/conf/. So I ran diff to compare two:

#diff fastcgi.conf fastcgi_params

< fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; < fastcgi_param QUERY_STRING $query_string;

fastcgi.conf conf file has 2 more lines. So I went to one of site conf file and replaced fastcgi_params with fastcgi.conf

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi.conf;
~~~~~~~~~~~~

After updating the conf file, I restarted fastcgi and nginx and the site runs fast and good as it was before.

phew it was a long night…

  1. Ubuntu is great OS. Ubuntu is very useful to programmers because it is the easiest OS to deal with a program. I hope it will upgrade more so that now it will be a people friendly OS.

    Great post! 🙂

    -Charle Villamil
    Visit us @: http://CoolTattooDesigns.net

Comments are closed.