There is a script available to do the nginx install on Ubuntu, but I haven't looked at it in a while. When I went through it there were changes that were needed for me to get it working. But, that was back pre-Ubuntu 16, so the script has changed to allow for systemd instead of upstart. In the coming weeks I plan to get in to it to replace my rocket servers with nginx. From my view, nginx is way easier to configure than apache.
Here is the script: https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh -Jim On Friday, April 24, 2020 at 10:20:42 AM UTC-5, VJ Sosa wrote: > > Thanks Jim, > > I will follow your advice on using Nginx. > However, it is not quite intuitive the way this configuration is explained > in the web2py book. Details are given for the Apache2 configuration. > It is assumed that the reader has enough knowledge on how to configure a > web server. > Could your recommend an step-by-step tutorial (Web2py + nginx > configuration for dummies), especially where secure configuration is > activated (HTTPS). > > Best regards, > Víctor. > > > On Fri, Apr 24, 2020 at 2:41 PM Jim S <ato....@gmail.com <javascript:>> > wrote: > >> VJ >> >> I agree web2py + rocket is a good way to go about this. >> >> But, in the documentation I believe it is recommended to not use Rocket >> for a production server. If running on linux I believe nginx is the best >> place choice for a web server. Yes, it is more complicated to setup, but >> in th end you're going to have a more reliable web stack. >> >> That being said, I have 3 production servers running my app. One uses >> nginx (Server A) and the other 2 (Servers B and C) use Rocket. However, I >> front-end servers B and C with haproxy to load balance between the two >> running rocket. I don't know what the issue is, but at least every few >> days I have to restart servers B and C because they lock up. I haven't >> been able to find any messages when this happens so I haven't been able to >> trouble-shoot yet. My plans are to rebuild these servers with nginx >> instead of rocket. >> >> TLDR; >> >> Rocket is great for development work, but I'd recommend using nginx in a >> production environment based on the recommendation in the book and on my >> own experience. >> >> -Jim >> >> On Friday, April 24, 2020 at 6:00:41 AM UTC-5, VJ Sosa wrote: >>> >>> Hi Jim and Clemen, >>> >>> I really appreciate your support and time. >>> I'm newbie in python programming, so my idea was to have an easy >>> implementation of my wepapp using web2py + Rocket (it was an excelent >>> option for me until this issue with Rocket arised). >>> So, I have decided to leave Rocket out of the equation and try to move >>> into the Apache or Nginx configuration, which implies to include a little >>> more stuff, >>> so I hope to be able of migrating my webapp soon. >>> >>> Just in case, if you found any solution for this Rocket issue with >>> Python 3 in web2py, it will be welcome. I'm still convinced that Web2py + >>> Rocket is the best option for faster development of webapps in Python. >>> >>> Regards, >>> Víctor. >>> >>> >>> >>> >>> >>> >>> El viernes, 24 de abril de 2020, 9:57:16 (UTC+2), Clemens escribió: >>>> >>>> Hello, >>>> >>>> it seems that there are some problems with rocket under Python 3.x. As >>>> posted a few weeks ago I have the following problem: >>>> >>>> *I've switched my web2py app from python2 to python3. The app itself >>>> works fine, but the web2py online debugger doesn't work anymore and is >>>> mostly freezing. Sometimes a get the following error message:* >>>> >>>> *Exception timeout: timeout('timed out',)* >>>> >>>> *Traceback (most recent call last): File "/usr/lib/python3.6/socket.py"**, >>>> line 586, in readinto return self._sock.recv_into(b) socket.timeout: timed >>>> out* >>>> >>>> *My configuration is as follows:* >>>> >>>> *web2py 2.19.1-stable+timestamp.2020.**03.21.21.49.28 (Running on >>>> Rocket 1.2.6, Python 3.6.9), Ubuntu 18.04 LTS* >>>> >>>> Do you have this problem too? Since this problem also depends on >>>> sockets, maybe this is a hint to a solution for "your" problem mentioned >>>> here. Of course I hope the solution would solve "my" problem too. >>>> >>>> In the meantime I've established short script switching between Python >>>> 2.x and 3.x. Means, using Python3 as long as I don't have to use the >>>> debugger and switching to Python 2 if required. The script is running >>>> under Linux. Any interest? >>>> >>>> >>>> Best regards >>>> >>>> Clemens >>>> >>>> >>>> >>>> On Thursday, April 23, 2020 at 10:24:36 PM UTC+2, Jim S wrote: >>>>> >>>>> VJ >>>>> >>>>> I just ran a test and can confirm I'm getting the same results as you. >>>>> >>>>> I just cloned the latest web2py from git. >>>>> >>>>> I ran under Python 2.7 and it worked fine. >>>>> Running under Python 3.7 and I get results like you. >>>>> >>>>> To do a little debugging, I put a print statement ahead of line 105 in >>>>> gluon/rocket.py -> print('socket_tuple', socket_tuple) I get the >>>>> following: >>>>> >>>>> Python 2.7 >>>>> ('sock_tuple', (<socket._socketobject object at 0x7f09d9a4eb40>, ( >>>>> '127.0.0.1', 32984))) >>>>> ('sock_tuple', (<ssl.SSLSocket object at 0x7f09d91f20d0>, ('127.0.0.1' >>>>> , 32986))) >>>>> ('sock_tuple', (<socket._socketobject object at 0x7f09d9a4ed70>, ( >>>>> '127.0.0.1', 32988))) >>>>> ('sock_tuple', (<socket._socketobject object at 0x7f09c84ee750>, ( >>>>> '127.0.0.1', 32990))) >>>>> ('sock_tuple', (<ssl.SSLSocket object at 0x7f09c84ec5d0>, ('127.0.0.1' >>>>> , 32992))) >>>>> ('sock_tuple', (<ssl.SSLSocket object at 0x7f09c84ec350>, ('127.0.0.1' >>>>> , 32994))) >>>>> >>>>> Python 3.7 >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33048)) >>>>> sock_tuple (<ssl.SSLSocket fd=5, family=AddressFamily.AF_INET, type= >>>>> SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 8000), raddr=( >>>>> '127.0.0.1', 33050)>, ('127.0.0.1', 33050)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33052)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33054)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33056)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33058)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33062)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33064)) >>>>> sock_tuple (<ssl.SSLSocket fd=4, family=AddressFamily.AF_INET, type= >>>>> SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 8000), raddr=( >>>>> '127.0.0.1', 33066)>, ('127.0.0.1', 33066)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33068)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33070)) >>>>> sock_tuple (<socket.socket [closed] fd=-1, family=AddressFamily. >>>>> AF_INET, type=SocketKind.SOCK_STREAM, proto=0>, ('127.0.0.1', 33072)) >>>>> >>>>> I don't know what's going on, but can confirm that this isn't fixed. >>>>> >>>>> -Jim >>>>> >>>>> >>>>> On Thursday, April 23, 2020 at 1:03:22 PM UTC-5, VJ Sosa wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> Thanks for asking: >>>>>> >>>>>> Web2py Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 >>>>>> >>>>>> Python version: 3.6.9 >>>>>> >>>>>> Regards, >>>>>> Víctor >>>>>> >>>>>> El jueves, 23 de abril de 2020, 19:05:17 (UTC+2), Jim S escribió: >>>>>>> >>>>>>> What is your version of web2py? >>>>>>> >>>>>>> -Jim >>>>>>> >>>>>>> On Thursday, April 23, 2020 at 11:12:02 AM UTC-5, VJ Sosa wrote: >>>>>>>> >>>>>>>> I have tried the same command, running web2py with python 2.7.17 >>>>>>>> and it works: >>>>>>>> >>>>>>>> python web2py.py -c web2py.crt -k web2py.key -i 0.0.0.0 -p 8080 >>>>>>>> --nogui -a 'Password' >>>>>>>> >>>>>>>> >>>>>>>> The problem occurs when running web2py with python3. >>>>>>>> I found the same discussion in this link < here >>>>>>>> <https://www.mail-archive.com/web2py@googlegroups.com/msg170386.html> >>>>>>>> >, >>>>>>>> but it seems that the error still persists. >>>>>>>> Any help? >>>>>>>> >>>>>>>> Regards, >>>>>>>> Víctor. >>>>>>>> >>>>>>>> El jueves, 23 de abril de 2020, 14:55:21 (UTC+2), VJ Sosa escribió: >>>>>>>>> >>>>>>>>> Hello Everyone, >>>>>>>>> >>>>>>>>> Maybe this is a silly question, but I run web2py using the >>>>>>>>> following command: >>>>>>>>> >>>>>>>>> python3 web2py.py -i 0.0.0.0 -p 8080 --nogui -a 'Password' >>>>>>>>> >>>>>>>>> Everything goes well. My application is working . My application >>>>>>>>> includes an authentication part, >>>>>>>>> and so far it is running on HTTP, so browsers warns me about I'm >>>>>>>>> using an insecure conexion . I was ignoring those messages so far.. >>>>>>>>> >>>>>>>>> However, i would like to activate the SSL conexion in the Rocket >>>>>>>>> server. >>>>>>>>> I tried to execute web2py using the following command: >>>>>>>>> >>>>>>>>> python3 web2py.py -c web2py.crt -k web2py.key -i 0.0.0.0 -p 8080 >>>>>>>>> --nogui -a 'Password' >>>>>>>>> >>>>>>>>> It runs, but when I try to connect to the server (my app) using my >>>>>>>>> browser: >>>>>>>>> xx.xx.xx.xx:8080/myapp >>>>>>>>> >>>>>>>>> The browser (Chrome) tells me that it is not possible to connect >>>>>>>>> to the site. >>>>>>>>> And the server part shows a list of errors, I'm including some of >>>>>>>>> them: >>>>>>>>> <<<< >>>>>>>>> Exception in thread Thread-2: >>>>>>>>> Traceback (most recent call last): >>>>>>>>> File "/usr/lib/python3.6/threading.py", line 916, in >>>>>>>>> _bootstrap_inner >>>>>>>>> self.run() >>>>>>>>> File "/home/vsosa/Applications/web2py/gluon/rocket.py", line >>>>>>>>> 1268, in run >>>>>>>>> conn = Connection(*conn) >>>>>>>>> File "/home/vsosa/Applications/web2py/gluon/rocket.py", line >>>>>>>>> 105, in __init__ >>>>>>>>> self.socket.settimeout(SOCKET_TIMEOUT) >>>>>>>>> OSError: [Errno 9] Bad file descriptor >>>>>>>>> >>>>>>>>> Exception in thread Thread-3: >>>>>>>>> Traceback (most recent call last): >>>>>>>>> File "/usr/lib/python3.6/threading.py", line 916, in >>>>>>>>> _bootstrap_inner >>>>>>>>> self.run() >>>>>>>>> File "/home/vsosa/Applications/web2py/gluon/rocket.py", line >>>>>>>>> 1268, in run >>>>>>>>> conn = Connection(*conn) >>>>>>>>> File "/home/vsosa/Applications/web2py/gluon/rocket.py", line >>>>>>>>> 105, in __init__ >>>>>>>>> self.socket.settimeout(SOCKET_TIMEOUT) >>>>>>>>> OSError: [Errno 9] Bad file descriptor >>>>>>>>> >>>>>>>>> <<< >>>>>>>>> >>>>>>>>> am I missing something? >>>>>>>>> is this the right way to execute web2py on Rocket using SSL: >>>>>>>>> >>>>>>>>> python3 web2py.py -c web2py.crt -k web2py.key -i 0.0.0.0 -p 8080 >>>>>>>>> --nogui -a 'Password' >>>>>>>>> >>>>>>>>> Thank you in advance. >>>>>>>>> >>>>>>>>> Best regards, >>>>>>>>> Víctor >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >> 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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/BFvo2tn9IAI/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/5a7b2319-d11b-49a7-b3df-e969d20744af%40googlegroups.com >> >> <https://groups.google.com/d/msgid/web2py/5a7b2319-d11b-49a7-b3df-e969d20744af%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Victor J. Sosa Sosa > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/c5d55eed-22fe-44eb-b3dc-e69ea74afca5%40googlegroups.com.