progrium / localtunnel

Expose localhost servers to the Internet
MIT License
3.2k stars 242 forks source link

How to start my own server with localtunnel? #73

Closed yangchenyun closed 9 years ago

yangchenyun commented 11 years ago

I want to install them on my private server.

Assuming I have local tunnel installed via pip both on client and server, how could I init the server? And how could I tell my client to connect to it?

Bouke commented 11 years ago

I have been trying the same, so here are some tips to get you started. You should install the requirements from requirements.txt, especially the forked yunomi package (not the pypi one).

pip install git+git://github.com/progrium/yunomi.git

To run the tunnel daemon use the command localtunneld. You have to provide two ports, one for frontend and one for backend. Also, depending on the hostname, you need to set the domain part -d. If your server name has three parts domain.xxx.yyy, the tunnelname will become aaa.domain.xxx.yyy. Counting from the right, it is the 4th part. So the full command is:

localtunneld 8000 8001 -d 4

From the client you would do localtunnel-beta -s [servername]:8000 8000.

The client will list the wrong URL, but it should work now:

Port 8000 is now accessible from http://4971c4afcdfd.v2.localtunnel.com ...

yangchenyun commented 11 years ago

Thanks! Almost get it. what is the usage of 8001 port for the localtunneld?

Bouke commented 11 years ago

8000 is the frontend port, which you connect to using your browser. 8001 is the backend port, which is used by your localtunnel client to connect to the tunnel.

progrium commented 11 years ago

That's right. I'll try to tighten up the path to running your own server and write a blog post about it.

dubchoi commented 11 years ago

+1 for this. It took me a bit of time to hunt down what was happening with the yunomi package. I think it'd be worthwhile to add just one more line to README for this!

pip install git+git://github.com/progrium/yunomi.git
rchampourlier commented 11 years ago

Hi,

I'm trying to run a server on my Ubuntu 12.04 server (config below), but I'm getting:

Here are the details, thanks for your help!

root@playground:~# localtunneld 80 8001 -d 4
usage: localtunneld [-h] frontend_listener backend_listener
localtunneld: error: unrecognized arguments: -d 4

localtunneld 80 8001
2013-08-23 14:23:25,613    INFO cli: starting frontend on ('0.0.0.0', 80) for None...
2013-08-23 14:23:25,613    INFO cli: starting backend on ('0.0.0.0', 8001)...
Segmentation fault

localtunneld 8000 8001
2013-08-23 14:22:33,826    INFO cli: starting frontend on ('0.0.0.0', 8000) for None...
2013-08-23 14:22:33,827    INFO cli: starting backend on ('0.0.0.0', 8001)...
Traceback (most recent call last):
  File "/usr/local/bin/localtunneld", line 9, in <module>
    load_entry_point('localtunnel==0.6.1', 'console_scripts', 'localtunneld')()
  File "/usr/local/lib/python2.7/dist-packages/localtunnel/server/cli.py", line 44, in run
    [frontend_hostname, str(frontend_address[1])])
TypeError: sequence item 0: expected string, NoneType found

Here is my Python / PIP setup :

Python 2.7.3 (default, Apr 10 2013, 05:46:21)
[GCC 4.6.3] on linux2

# pip list
apt-xapian-index (0.44)
argparse (1.2.1)
chardet (2.0.1)
distribute (0.7.3)
eventlet (0.9.17)
greenlet (0.3.1)
localtunnel (0.6.1)
pip (1.4.1)
python-apt (0.8.3ubuntu7.1)
python-debian (0.1.21ubuntu1)
requests (0.14.1)
setuptools (1.0)
unittest2 (0.5.1)
wsgiref (0.1.2)
yunomi (0.2.2)

I've installed the requirements as specified in requirements.txt, including the yunomi's fork.

Here's what I get:

Bouke commented 11 years ago

@rchampourlier try localtunnel-beta -s hostname:8000 8000

rchampourlier commented 11 years ago

Hi @Bouke,

Thanks for your answer, but isn't localtunnel-beta the command for the client? The issues I'm facing are when starting the server.

progrium commented 9 years ago

FYI that version has reached EOL.