web2py - allow external access - how?
Asked Answered
G

3

12

I want to start a web2py server so that it can be accessed externally to the hosting server.

I've read this http://web2py.com/books/default/chapter/29/03

By default, web2py runs its web server on 127.0.0.1:8000 (port 8000 on localhost), but you can run it on any available IP address and port. You can query the IP address of your network interface by opening a command line and typing ipconfig on Windows or ifconfig on OS X and Linux. From now on we assume web2py is running on localhost (127.0.0.1:8000). Use 0.0.0.0:80 to run web2py publicly on any of your network interfaces.

but I can't find how to "Use 0.0.0.0:80" ? There doesn't seem to be a command line argument which would do that.

Thanks


EDIT: I should say the server in question does not have a GUI - I'm aware there's some sort GUI based admin facilties for web2py but that's out of the question here.


EDIT2: Just in case this is not clear (and on the offchance it makes any difference - which I doubt) I'm running the server like this :

sudo python web2py.py

not via wsgi/apache or the like.

Gagliano answered 7/12, 2012 at 2:40 Comment(1)
You'll need root (sudo) to bind to port 80 for sure. That said, port 8000 should be fine for dev work, and you shouldn't be using the build-in server for production anywayDonadonadee
S
15
python web2py.py --ip 0.0.0.0

just works fine but the log message will point you to an invalid address:

please visit:
    http://0.0.0.0:8000

alternatively you can use ethernet interface ip but it will not listen also on localhost

Sightread answered 7/12, 2012 at 3:59 Comment(0)
I
4

What may help you is the fact that you can select the public ip when the server gui pops up asking for the admin password.

If answered 7/12, 2012 at 10:24 Comment(1)
the server does not need the guy, I started it without tkinterSightread
E
-2

do the following in a terminal

install ufw with apt
add 8000 to firwall.
ufw allow 8000/tcp
ufw allow 8000/tcp

navigate to where your downloaded web2py is and cd web2py

use nano serverstartup.sh and add the line bellow

python2.7 web2py.py -a 'Server admin passwrod' -c server.crt -k server.key -i your device IP address -p 8000

change the the server admin password to any password of your choice.

chmod +x serverstartup.sh

run ./serverstartup.sh in your terminal

that is it. you can stop the server by holding control and c key on your keboard.

Extent answered 10/4, 2017 at 9:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.