1

I'am not quite sure how to describe what I really asking for, so i will try:

I have two computer A and B.

Computer A is my primary computer I'am working on. I'am web developer, and as you may know, I'am using XAMPP / WAMP applications to deploy a server Apache/MySQL/PHP etc... so I can use: http://localhost and http://127.0.0.1 to access my websites on localhost machine.

Now at the moment, I'am not at home, currently on Computer B. I would like to access Computer A from Computer B so I can use http://localhost/ adresse on Computer B to access the websites I've been developing on Computer A.

I remember someone told me something about tunneling throught SSH (i.e. in PUTTY), but I'am not sure how to do it. So I would be really glad if someone could give me a hand on this.

Thanks

==== UPDATED ====

Configuration on both computer are the same: OS Windows 7 64bit.

==== UPDATED 2 ====

Both computers are accessible with public IP addresses.

2
  • 1
    Please always include your OS. Solutions very often depend on the Operating System being used. Are you using Windows, Linux, Unix, OSX, BSD? Which version?
    – terdon
    Jan 30, 2014 at 14:03
  • sorry, forgot about it. updated Jan 30, 2014 at 14:38

3 Answers 3

7

If computer A is reachable via SSH, an SSH tunnel would be indeed the way to go:

computer-B$ ssh -L 1234:localhost:80 computer-A.example.com

Once you're logged in, point your browser to http://localhost:1234 and the webserver on computer A should respond.

With putty, there's a "Tunnels" menu underneath the "SSH" option (left side) where you can configure the same forwarding.

Update: While virtually all Linux distributions are shipping an OpenSSH server, Windows operating system has no such thing by default. There are however SSH servers for Windows available. Once the SSH server is running on computer A (and port 22/TCP is forwarded to that computer, if it's behind a router), you can use the example above to finally connect to computer A either via command line or via a graphical SSH client, like Putty.

4
  • I have installed OpenSSH server on A, and OpenSSH Client on B. There is no such a command line where I can apply your code. I tried to connect but it's not responding to the IP. IP is correct, ports forwarded to 22, 23, 80 to comp A. Any suggestion ? Jan 31, 2014 at 1:41
  • Now with your updated description (Windows OS on both ends), let me emphasize my first sentence: "If computer A is reachable via SSH" :-) If you don't have an SSH server installed on computer A, SSH tunneling won't be an option for you. One could still use a VPN solution, but this may be even harder to set up properly.
    – ckujau
    Jan 31, 2014 at 4:41
  • I've updated my question. Pls could you modify your answer depending on my computer's IP adresses ? thank yoi Jan 31, 2014 at 12:55
  • 1
    Forwarding port 80 makes your development enivronment accessible to the internet, which I absolutely don't recommend! Jan 31, 2014 at 13:00
0

On Linux, this is all possible with onboard-tools. You would just forward port 22 to your system (or better use a random port to prevent it to be found by automated scanners).
By the way Linux is the better environment to develop and test web applications as they will be running on a lamp systen later in 99.9%.

On linux, you would run sshfs to edit the files, and ssh portforwarding to access http and maybe sql.
On Windows, I would use TeamViewer VPN to tunnel http, and use ftp to access the file system.

2
  • thanks, will try to find more about that teamviewer vpn. btw I can't switch to linux at themoment, but thinking about it already. Jan 31, 2014 at 13:41
  • You can switch, and run your old apps in virtualbox - maybe. I switched and don't miss the time running 12 installers to update my system after 2 weeks. Jan 31, 2014 at 13:43
0

You may want to setup a OpenVPN or TINC network between your two computers. This is a little of a hammer to kill a fly, but it will allow you to view your development server without opening it to the internet.

Another possiblity is to setup the Apache 2 server to listen on the internet and protect it with a global basic auth setting (login + password to access the hosted sites).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .