Thank you, Ricardo. 

That works great now if I go directly to http://xxx.xxx.xxx.xx:9001 (where 
xxx.xxx.xxx.xx is the ip address of the server). 

However, if I go to http://test.mysite.org then I get a 504 Gateway Timeout 
Error. It appears that nginx is not forwarding the request to uwsgi. 

Can you please take a look at the nginx configuration file that I attached 
with my last email (only the last 5-6 lines are relevant for this 
application, others are NodeJS apps and they are working fine) and let me 
know if I need something more there? 

I have two more questions: 

(1) Is using *uwsgi_pass 127.0.0.1:9001* instead of *uwsgi_pass *
unix:///tmp/web2py.socket problematic? I would like to keep things simple.
(2) Can I just use .ini file like the one I attached and use it with uwsgi 
emperor instead of the xml file?

Thank you so much for your help. 


On Tuesday, October 22, 2013 11:31:38 PM UTC-4, Ricardo Cárdenas wrote:
>
> Hello curious,
>
> I'll assume you're using web2py 2.6 (you reference the handlers/ 
> directory, which is new). Please review handlers/README. wsgihandler.py 
> (all handlers in fact) is meant to be copied to web2py's root directory. 
> Hope this helps, please report back...
>
> best regards -Ricardo
>
>
> On Tuesday, October 22, 2013 8:54:48 PM UTC-5, curiouslearn wrote:
>>
>> Niphlod,
>>
>> Thanks again. Is uwsgi faster/safer? Anyhow, I tried doing what you said. 
>> But instead of following the difficult instructions in the web2py book, I 
>> used the instructions in uwsgi documentation. I have attached three files:
>>
>> (1) My nginx configuration. (mysite_nginxconf.com)
>> (2) uwsgi configuration (wsgiconf.ini)
>> (3) The console output when I run uwsgi directly (now there is some 
>> output and it gives some idea about the error). When I try to visit the 
>> site I get "Internal server error" message. (uwsgi_consoleLog.txt)
>>
>> One problem I see is that ImportError: No module named wsgihandler
>>
>> But I see wsgihandler.py in the web2py/handlers folder. Should it not 
>> read it from there? Do I have to install it separately, or give path to it 
>> somehow?
>>
>> Really appreciate your help. Difficulty to deploying python apps is 
>> frustrating and despite all the great things web2py offers, the difficulty 
>> in deployment might otherwise require me to use something else.
>>
>>
>>
>>
>> On Tuesday, October 22, 2013 5:41:38 PM UTC-4, Niphlod wrote:
>>>
>>> low performances vs running web2py on uwsgi.
>>>
>>> PS: try running uwsgi directly pointing to that config file (i.e. no 
>>> emperor mode with upstart, so you get a chance to see any logged error that 
>>> may pop up)
>>>
>>> On Tuesday, October 22, 2013 10:15:16 PM UTC+2, curiouslearn wrote:
>>>>
>>>> While some helpful soul helps me understand how to setup web2py to work 
>>>> with nginx and uwsgi, I had another question. 
>>>>
>>>> Is there anything wrong, or problematic in using the following for 
>>>> deployment
>>>>
>>>> Run web2py using 
>>>>
>>>> python web2py.py -a mypasswd -i 0.0.0.0 -p 9001
>>>>
>>>> and then use nginx to direct traffic from http://mydomain.com to this 
>>>> running instance. 
>>>>
>>>> This seems an easy way to do it. What I am risking by doing this?
>>>>
>>>> Thank you.
>>>>
>>>> On Tuesday, October 22, 2013 3:28:21 PM UTC-4, curiouslearn wrote:
>>>>>
>>>>> Niphlod,
>>>>>
>>>>> Thanks for getting back to me. There is no file that has uwsgi-emperor 
>>>>> in its name in /var/log/upstart.
>>>>>
>>>>> Anything else I can do to find what is the problem? 
>>>>>
>>>>> On Tuesday, October 22, 2013 1:03:37 PM UTC-4, Niphlod wrote:
>>>>>>
>>>>>> every upstart job logs something into 
>>>>>>  /var/log/upstart/name_of_the_service.log
>>>>>>
>>>>>> check if you have something on /var/log/upstart/uwsgi-emperor.log
>>>>>>
>>>>>> On Tuesday, October 22, 2013 6:48:42 PM UTC+2, curiouslearn wrote:
>>>>>>>
>>>>>>> I want to get web2py running on a Digital Ocean virtual server with 
>>>>>>> nginx and uWSGI. I followed the instructions on deployment recipes in 
>>>>>>> Web2py book, but things are not working. The following are the 
>>>>>>> differences 
>>>>>>> between the instructions given in the book and my specific case. 
>>>>>>>
>>>>>>> *Differences from instructions given in web2py deployment recipes*
>>>>>>> (1) I have web2py installed in "/home/username/web_apps/web2py" instead 
>>>>>>> of in "/home/www-data/web2py"
>>>>>>> (2) The configuration file is called "/etc/nginx/sites-available/
>>>>>>> myconfig.org" instead of "/etc/nginx/sites-available/web2py"
>>>>>>> (3) For now I am ignoring settings related to ssl since I am just 
>>>>>>> trying to get this to work.
>>>>>>>
>>>>>>> *The configuration I am using:*
>>>>>>>
>>>>>>> *1.* In the nginx file I have the following. Since I have other 
>>>>>>> non-web2py apps running I don't want to listen on 80:
>>>>>>>
>>>>>>> *server {*
>>>>>>> *
>>>>>>> *
>>>>>>> *    server_name $hostname;*
>>>>>>> *    listen 9001; *
>>>>>>> *    access_log /var/log/nginx/me.log;*
>>>>>>> *
>>>>>>> *
>>>>>>> *    location / {*
>>>>>>> *        uwsgi_pass unix:///tmp/web2py.socket;*
>>>>>>> *        include uwsgi_params;*
>>>>>>> *        uwsgi_param UWSGI_SCHEME $scheme;*
>>>>>>> *        uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;*
>>>>>>> *    }*
>>>>>>> *}*
>>>>>>>
>>>>>>> *
>>>>>>> *
>>>>>>> *2.* In the /etc/uwsgi/web2py.xml file I have:
>>>>>>>
>>>>>>> *<uwsgi>*
>>>>>>> *    <socket>/tmp/web2py.socket</socket>                   *
>>>>>>> *    <pythonpath>/home/username/web_apps/web2py/</pythonpath>*
>>>>>>> *    <mount>/=wsgihandler:application</mount>              *
>>>>>>> *    <master/>                          *
>>>>>>> *    <processes>1</processes>           *
>>>>>>> *    <harakiri>60</harakiri>            *
>>>>>>> *    <reload-mercy>8</reload-mercy>     *
>>>>>>> *    <cpu-affinity>1</cpu-affinity>     *
>>>>>>> *    <stats>/tmp/stats.socket</stats>   *
>>>>>>> *    <max-requests>2000</max-requests>  *
>>>>>>> *    <limit-as>512</limit-as>           *
>>>>>>> *    <reload-on-as>256</reload-on-as>   *
>>>>>>> *    <reload-on-rss>192</reload-on-rss> *
>>>>>>> *    <uid>web_apps</uid>                *
>>>>>>> *    <gid>web_apps</gid>                *
>>>>>>> *    <no-orphans/>                      *
>>>>>>> *</uwsgi>*
>>>>>>>
>>>>>>>
>>>>>>> 3. The uwsgi-emperor.conf is identical to that in the instructions.
>>>>>>>
>>>>>>> When I run sudo start uwsgi-emperor I get an error saying,
>>>>>>>
>>>>>>>      * start: Job failed to start*
>>>>>>>
>>>>>>> I have no clue what the error is. Would help setting this up. Where 
>>>>>>> am I making a mistake? Do I need to start web2py separately, or is the 
>>>>>>> above script supposed to start it?
>>>>>>>
>>>>>>> Any help in understanding where I am going wrong and getting this 
>>>>>>> working would be very helpful.
>>>>>>>
>>>>>>> Thank you.
>>>>>>>  
>>>>>>>
>>>>>>>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to