Ok my question here should've been more to the point. The bottom line is: I have a remote linux box and I started up web2py on it just fine - it's prompting me to visit port 8000 on the localhost.
However, when I try to visit that port remotely, I am unable to establish a connection via http or https.
So the question becomes, what is the fastest simplest way to provide remote admin access to web2py? I dont feel like setting up Apache and mod_proxy (although I did manage to get it setup) and I dont feel like configuring Apache to use this wsgi wrapper. If those are my only 2 options, then so be it, I will try to get that done.
But I'd rather just start up web2py with some sort of option that allows secure remote access and be done with it.
Due to security reasons, web2py disables remote access to the admin app unless you are using a secured channel, ie. HTTPS. You all you need to do is set that up.
The shortest way to do what you want is,
Start by generating your certificate files, if you don't have them already
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Copy the server.key and server.crt files to your web2py root folder.
Then start the web2py application using the certificate files
python web2py.py -a 'AdminPwd' -c server.crt -k server.key -i 0.0.0.0 -p 8000
Then go to the browser and open, please note that the https is important
https://IpAddr:8000/admin/default/site
This should open the admin application on the remote machine.
The best way to do what you want is,
Use this nice script (setup-web2py-nginx-uwsgi-ubuntu.sh) to setup nginx with web2py using uWSGI on ubuntu. The script will setup the required https and http channels for you.
The methods described above are meant to be used in a development environment and not a production environment
The easiest way to do this is with SSH port forwarding. This allows you to access it like the local host does, and it is over an encrypted connection.
format:
$ ssh -L localhostport:localhost:remoteport remoteip
example: this will forward the remote port 8000 (web2py default), to localhost:80
$ ssh -L 80:localhost:8000 remoteip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With