Solution for nginx “504 Gateway Time-out”

January 28, 2012 by · 4 Comments
Filed under: server, troubleshooting 

When my website routes path /mybackup to pyramid application.”504 Gateway Time-out” occured. And I set  several fastcgi parameters in the nginx.conf a following:

 fastcgi_connect_timeout 300s;
 fastcgi_send_timeout 300s;
 fastcgi_read_timeout 300s;
 fastcgi_buffer_size 128k;
 fastcgi_buffers 8 128k;

But it doesn’t work. And then found that nginx was proxy_pass the path to pyramid(wsgi), so the fastcgi config does not help (it only works for fastcgi), the complete configuration is:

location /mybackup {
       send_timeout 180;
       proxy_read_timeout 120;
       proxy_connect_timeout 120;
       index  index.jsp index.html index.htm;
       proxy_pass http://127.0.0.1:8080;
       proxy_set_header  X-Real-IP  $remote_addr;
}
Digg This
Reddit This
Stumble Now!
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

How to install pyramid

January 27, 2012 by · Comments Off on How to install pyramid
Filed under: python 

1.Install python 2.7/3.x

2.Install setuptools

For windows, need to add C:\Python27\Scripts to PATH variable

3. Install virtualenv

$ easy_install virtualenv

create a virtual environement mysite:
$virtualenv mysite
$cd mysite
$source bin/activate

Then a new environment variable VIRTUAL_ENV would be set. And virtualenv modified your $PATH variable too by appending bin/python to $PATH; So pythonpath could be in the current directory. virtualenv also installed pip and easy_install in ENV/bin.

How to clean virtual environment:
$virtualenv –clear mysite

4.Install pyramid

After you’ve got your env virtualenv installed, you may install Pyramid itself using the following commands from within
the virtualenv (env) directory:

$ bin/easy_install pyramid

Digg This
Reddit This
Stumble Now!
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)