On Fri, 4 Oct 2013 14:04:09 -0700 (PDT)
Niphlod <[email protected]> wrote:
Hello Niphlod,
> >
> > > as often, you're making things much more complicated then they
> > > really are.
> >
> > I don't understand?
> >
>
> if you read the code of admin, you'll quickly realize.
First of all I thought that in the above replaced me with someone else
("...your're making things much more complicated..."), but then
understood it's a general comment. :-)
Second, I'm really web2py noob and although hoping to be able to
contribute back to the project one day, I consider it's still a bit too
early for me to read admin code. ;)
> if gunicorn is listening on port 8888, then you'll need a
> parameters_8888.py.
That's clear.
> didn't you say that admin works if you place a parameters_80.py
> file ?
Yes.
> then gunicorn is working on port 80, or it does simulate to
> work on that port.
That's not clear to me...
I did simplify my setup by eliminating customized nginx at the front-end
and launching gunicorn with:
a) /home/somepath/virtualenvs/com/bin/python
/home/somepath/virtualenvs/com/bin/gunicorn \
-D -b 127.0.0.1:localport --worker-class sync
--pid /home/somepath/virtualenvs/com/com.pid
--pythonpath /home/somepath/virtualenvs/com/web2py
--chdir /home/somepath/virtualenvs/com/web2py wsgihandler --preload
where 'localport' is unprivileged port in the range of 60K.
if I check things in Firebug, I can see that the request to http://tld/
shows Welcome app and as remote IP is listed the w.x.y.z:80 IP address.
If I try with: https://tld/, request shows Welcome app with the same
w.x.y.z:443 IP address.
It means, to me, that master nginx at the front end working as reverese
proxy is working as expected and is dispatching appropriate requests to
the gunciorn server listening on 127.0.0.1:localport where 'localport is
neither 443 nor 80 and not sure how it would emulate port 80 either.
Now, when I try to press button to launch admin interface, web2py
responds with 'admin disabled because unable to access password file'
cause there is no parameters_80.py available.
With parameters_80.py attempt via port 80 (http) gives:
ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.
and via 443 (https) works as expected allowing to login.
In order to make things even simpler, I tried with:
b) python anyserver.py -s gunicorn -p localport
withing virtualenv having web2py & gunicorn installed.
Here is the console output:
starting gunicorn on 127.0.0.1:localport...
/usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module
_mysql was
already imported from /usr/lib/pymodules/python2.6/_mysql.so,
but /usr/lib/pymodules/python2.6 is being added to sys.path from
pkg_resources import resource_stream 2013-10-05 08:59:12 [8229] [INFO]
Starting gunicorn 18.0 INFO:gunicorn.error:Starting gunicorn 18.0
2013-10-05 08:59:12 [8229] [INFO] Listening at: http://127.0.0.1:62019
(8229) INFO:gunicorn.error:Listening at: http://127.0.0.1:62019 (8229)
2013-10-05 08:59:12 [8229] [INFO] Using worker: sync
INFO:gunicorn.error:Using worker: sync
2013-10-05 08:59:12 [8241] [INFO] Booting worker with pid: 8241
INFO:gunicorn.error:Booting worker with pid: 8241
Again, Firebug shows request coming at port 80 for http and 443 for
https.
Attempt to access admin interface results, again, with 'admin
disabled...'.
If I provide parameters_80.py file and attempts via port 80, I get the
form and:
ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.
and attempt via https works as expected.
Finally, I tried:
c) python web2py.py -p localport -a "<recycle>"
/usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module
_mysql
was already imported from /usr/lib/pymodules/python2.6/_mysql.so,
but /usr/lib/pymodules/python2.6 is being added to sys.path from
pkg_resources import resource_stream ERROR:root:New installation error:
unable to create welcome.w2p file web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.6.4-stable+timestamp.2013.10.01.15.24.15
Database drivers available: SQLite(sqlite2), SQLite(sqlite3),
MySQL(pymysql), MySQL(MySQLdb), PostgreSQL(psycopg2),
PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc),
Ingres(pyodbc), CouchDB(couchdb), MongoDB(pymongo), IMAP(imaplib)
please visit: http://127.0.0.1:localport/ use "kill -SIGTERM 9318" to
shutdown the web2py server
and visiting the site via http, shows request via port 80 and attempt to
access admin interface fails, but shows 'Login to the Administrative Interface'
form,
while the request via https shows the form and allows me to login.
So, the c) works fully according to my expectations allowing remote
access to admin only via https (port 443) and not via port 80.
Moreover, in all three cases, listening is happening on the same
localport different than 443 or 80, and the working case in c) is, to me
proof, that nginx reverse proxy does it job of properly
dispatching requests.
However, when gunicorn comes into play, for some reason, web2py expects
existence of parameters_80.py file.
Any explanation?
Sincerely,
Gour
--
Before giving up this present body, if one is able to tolerate
the urges of the material senses and check the force of desire and
anger, he is well situated and is happy in this world.
http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.