Nginx/passenger/web2py -> 504 Gateway Timeout?

442 views
Skip to first unread message

Krzysztof Socha

unread,
Apr 14, 2014, 4:15:06 AM4/14/14
to
I am trying to setup (vanila) web2py on shared hosting with nginx and passenger with support for python. I put all the files from web2py folder in the folder expected by passenger, I created a file passenger_wsgi.py required by passenger, which I simlinked to wsgihandler.py (taken from the handlers dir to the dir where web2py.py resides). The result: nothing works - I get consistently 504 Gateway Timeout for every attempted connection. 

On the other hand, when I simply created a passenger_wsgi.py file that contained:

def application(environ, start_response):
  start_response
('200 OK', [('Content-Type', 'text/plain')])
 
return [b"hello world!\n"]

then everything works fine - i.e., I get the "hello world". 

I believe, it takes about one minute for the request to time-out... Does the web2py startup take so long?  When can/should I do to make it work?

Krzysztof.


Richard Vézina

unread,
Apr 14, 2014, 9:58:16 AM4/14/14
to web2py-users
Use unicorn!!

Phusion is more work...

You can have a look in contrib there is a scrip that help deploy redmine beside web2py with unicorn, so you can derive something for you need from it. It works with 12.04.

Richard


def application(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')]) def application(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')])
  return [b"hello world!\n"]

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Krzysztof Socha

unread,
Apr 15, 2014, 3:34:05 AM4/15/14
to web...@googlegroups.com
Thanks... But I kinda cannot... The hosting I am using is providing nginx + phusion passenger... and it works with a simple script, as I have shown. Unfortunately, it looks like the web2py handler never returns anything and the request time-outs... I do not even know where to look to understand what happens... Any suggestions?

Krzysztof.

Richard Vézina

unread,
Apr 15, 2014, 12:17:17 PM4/15/14
to web2py-users
I make it works with Phusion long time ago, and then get convinced after reading a blog post that this were a bad idea, since at that time phusion was not following the same rule as other linux in matter of service managment, so I resign. I remember having read and work hard, since there were no single one-stop place to make it works... The phusion doc, was the better place + blog post and tuto.

Sorry I couldn't help more... But I would again suggest you to walkaway of phusion if you can somehow. My understanding is this project is not enough or wasn't (1,5 years ago) to work in production. I was required to compile Nginx to include phusion module because it is not include by default, to me just that is enough to not consider it prod ready...

Richard


LightDot

unread,
Apr 16, 2014, 6:59:36 AM4/16/14
to web...@googlegroups.com
I use apache and mod_passenger (Scientific Linux 6.x / EPEL) on a couple of high traffic web2py apps, works like a charm. Passenger is really neat, I'm testing an unified solution that provides python, nodejs and ruby support with seamless passtrough for PHP / HTML / static files.

Apart of configuring apache / passenger, the only thing needed on web2py side was to use wsgihandler.py, renamed as passenger_wsgi.py.

So, I would say this is a configuration issue... But I'm not sure what's the problem. @Krzysztof, when you say you've put all web2py files within the folder, expected by passenger, did you omit the top web2py directory? The structure should be simply:

top_passenger_dir/
  applications
  deposit
  gluon
  ...etc...
  passenger_wsgi.py
  web2py.py

Regards

Krzysztof Socha

unread,
Apr 17, 2014, 7:57:40 AM4/17/14
to web...@googlegroups.com
Yes - this is what I did. And yes - it seams to be a configuration issue... It is just that I have no clue where to look :( 

LightDot

unread,
Apr 17, 2014, 11:57:07 AM4/17/14
to web...@googlegroups.com
First thing, try ditching the symlink and copy the wsgihandler.py directly to passenger_wsgi.py. There might be a security measure in place, preventing symlinks.

The next thing I'd try is seeing if the paths within the passenger_wsgi.py get proper values, but this might be a long shot.

Since you say you're on a shared host, I assume you can't see how your web server and passenger configuration files actually look like? That would help.
Reply all
Reply to author
Forward
0 new messages