11

I want to make my site available world wide. Im using xampp server for hosting. I have no access to any kind of servers and modems. Situation is shown below:

My site server has local ip assigned by wifi router and it runs Windows 8.

Remember I have no access on any kind of servers and modems so port port-forwarding is impossible (out of my scope).

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
rickj
  • 210
  • 2
  • 11
  • Hi, can you clarify what your question is? – Pekka Aug 20 '13 at 16:03
  • thanx for replying , what do you want me to clarify? i think the image will help.. – rickj Aug 20 '13 at 16:15
  • You will need to set up port forwarding in your router for this. If you can't do that, I don't think there is a way to do it. Either way, are you sure you can't simply rent a small web hosting package somewhere? It's much easier and if you want the site to be available 24/7, it might even be cheaper when you consider the energy costs.... – Pekka Aug 20 '13 at 16:29
  • @Pekka Thanks for suggestion. Actually I have some private data which has to be hosted and my company can't trust at this stage. – rickj Aug 20 '13 at 17:18
  • I would just use a trustworthy, big hosting company and be done with it. You're likely to have more security risks with a self-hosted solution. Either way, you would have to be able to configure your router with port forwarding. If you can't do that, there simply is no way to do it. – Pekka Aug 20 '13 at 18:35
  • Well..can you tell us why you can't do any port forwarding activity? Maybe by knowing the source of you limitation..we can help find another answer for this question. – yogipriyo Feb 04 '14 at 02:19
  • @yogipriyo Thanks for interest. Imagine you are in an university, where you have good internet connection and bandwidth, but there are a lot many routers and server in between, so it's difficult to use post forwarding technique and configure all servers and router :( The data is highly confidential and all incoming request are monitored thoroughly for to prevent leakage and thus can't be hosted on neither public servers nor VPS. – Rishabh Goyal Feb 04 '14 at 18:34
  • @rickj i would request you to start bounty for this question, as iam unable to do it, In return I would start bounty for other of your question – Johny Pie Feb 09 '14 at 14:54
  • @JohnyPie done and thanks for your interest.. – rickj Feb 09 '14 at 14:57
  • FWIW, I've read that the dark web doesn't require port forwarding to make a server available outside your local area network. It's a shame that people don't advertise that as it's figurative selling point instead of anonymity. If they can do it, you can program another solution to do it, too. – Brōtsyorfuzthrāx Jul 26 '22 at 01:36
  • @yogipriyo I don't know about rickj, but at least one popular ISP (probably more) doesn't allow port forwarding on its routers (and you can't use an alternative router). Yeah, the options are there to set it up, but it doesn't actually work like it used to. I'd be interested to know if you've actually tried port forwarding anything lately, and if it worked--and what your ISP is. But, that's probably too personal. But wow, this is an old question (sorry). – Brōtsyorfuzthrāx Jul 26 '22 at 01:41

7 Answers7

3

Its actually difficult, but not impossible.

One way, I would approach this is:

  1. I would host a page on internet.

  2. Then take request and store it in database.

  3. One of my program will always be running from my computer.

  4. Then check for request and curl the request to localhost. For this you may use Node.js (taking data from database using GET method and curl it to localhost).

This is the best I could think of. And I am working on it, when the code is ready I'll make it open source and notify you :)

But still, it's difficult, as you need to put user's request to sleep for 2 seconds and then transferring it. Its slow, but may work out for you.

Disadvantages:

  • Program will be very slow and memory usage will be more.

  • Breaking may happen many times.

  • High bandwidth wastage

  • If not encrypted, MIM (Men in Middle) may possible.

Advantages:

  • Indirect method of hosting

  • Need not to worry about your code being lost.

I am looking forward for a better alternative and I would like to keep this question for bounty once again.

Luke
  • 565
  • 5
  • 19
Johny Pie
  • 843
  • 3
  • 14
  • 37
2

If you cannot open the necessary ports within your LAN you will require access to an external server. However, the external server does not need to host any code, e.g.

  1. Create a Linux based ec2 instance using Amazon's free tier.
  2. Install a package to redirect remote to local ports:

    a. using socat:

    1. Install socat using your distributions package manager

    2. Connect via SSH: ssh -N -R 42500:127.0.0.1:80 -o ServerAliveInterval=60 ubuntu@xxx.xxx.xxx.xxx -N -R 8080:localhost:80 "socat TCP-LISTEN:8080,fork TCP:127.0.0.1:42500"

    b. using a webserver and reverse proxy:

    1. Install apache or nginx and any required reverse proxy modules and configure your VirtualHost to proxy requests to a local port, e.g. :8080 -> 127.0.0.1:42500

    2. Connect via SSH: ssh -N -R 42500:127.0.0.1:80 -o ServerAliveInterval=60 ubuntu@xxx.xxx.xxx.xxx

  3. Your machine is now reachable via the ec2 instance http://xxx.xxx.xxx.xxx:8080/.

I occasionally use this technique when debugging web service callbacks.


Update 17-02-2014

If you are a Windows user you will need to install a third-party tool to support ssh. Options include:

PuTTY is the easiest choice if you are not familiar with *nix tools. To configure remote port forwarding in PuTTY expand the following setting: Connection -> SSH -> Tunnels. Given the previously described scenario, populate Source port as 42500, Desination as 127.0.0.1:80 and tick the Remote option. (You may also need to add the path to a PuTTY compatible private key in the Connection -> SSH -> Auth tab depending on your server configuration.

PuTTY remote port forwarding

To test you have successfully forwarded a port, execute the command netstat -lnt on your server. You will see output similar to:

tcp     0    0    127.0.0.1:42500    0.0.0.0:*    LISTEN

Finally you can test with curl http://127.0.0.1:42500. You will see the output of your own machines web root running on port 80.

Andrew Mackrodt
  • 1,806
  • 14
  • 10
  • @andrew.. hey iam interested to know the process name. I could not understand from step 4. Is it possible to provide some pics or more explanation about it. I'll give you 50 points as bounty(start again), as soon as your steps proven to be working :) – rickj Feb 17 '14 at 16:45
  • @rickj I've updated my answer to aid Windows users make an SSH connection. – Andrew Mackrodt Feb 17 '14 at 17:27
  • please correct me if I am wrong. First I should take a ssh from the server and then use it for auth. This is followed by your updated answer(for windows). Putty has to be installed on localhost..right? and then obtain key from server. Can you also explain about bandwidth usage..I mean will the server act as a proxy for web clients .. please share something more.. thanks for sparing your valuable time.. – rickj Feb 17 '14 at 19:28
  • SSH is the standard *nix protocol for remote server access, you may think of it like Windows RDP. Similar to how Windows RDP lets you take forward a printer to the remote device, SSH will let you take forward ports. The SSH server runs on the remote (proxy) machine and you will connect via PuTTY from localhost. Amazon has a good tutorial detailing this: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html - RE: bandwidth usage, your understanding is correct, the flow of traffic is: `Client <> Proxy <> localhost`. – Andrew Mackrodt Feb 18 '14 at 09:50
  • thanks for tips. Actually Im some other hosting provider. With the tip that you have given, I'll have to go with Amazon. Do you have any other solution, I guess my hosting provider supports SSH console but not ec2. – rickj Feb 19 '14 at 19:57
1

if you don't have a public IP address and cannot use port forwarding it is impossible to host the site

terve
  • 21
  • 4
  • Thanks for replying. But I want to do that some how. – rickj Aug 20 '13 at 18:34
  • @rickj well, it's not possible. – Pekka Aug 20 '13 at 18:34
  • @rickj yes. You'll need a public IP (which your Wi-Fi router probably has) and the router needs to be able to forward port 80 to your server. There is no other way – Pekka Aug 20 '13 at 18:37
  • @Pekka are you sure. No chance even for data transmission. Or somthing like hosing a page and requeting the server i.e. my server. Because when seeding in torrent and uploading, etc are possible, then why this is not! – rickj Aug 20 '13 at 18:38
  • @rickj Torrents work differently: they actively initiate a connection on both sides. This is called "hole punching". [Here](http://stackoverflow.com/questions/7225150/forward-traffic-from-port-x-to-computer-b-with-c-sharp-udp-punch-hole-into-fir) is a (very complex) illustration of how it's done. You could theoretically build something that can fetch data from your private location, but you would have to have real hosting as well and the effort required to build this would be huge. – Pekka Aug 20 '13 at 18:44
  • @Pekka웃 what do u call this technique? I want to study more about the topic. – rickj Aug 21 '13 at 12:25
  • @rickj "hole punching" is a good place to start http://en.wikipedia.org/wiki/Hole_punching – Pekka Aug 21 '13 at 21:27
  • @Pekka Thanks for tips.If would like to know if there any force port forwarding tool. – rickj Aug 24 '13 at 12:43
  • @rickj you'd likely have to engineer it yourself. The effort required would be huge. This is insane and makes no sense. – Pekka Aug 24 '13 at 13:14
1

As people have said you need a public IP address. However, even if you did you should not use xampp as a public server, as it is designed for development and therefore has some security settings disabled.

I would recommend buying some shared web hosting, and uploading it to that. (you can get cheap hosting if you google 'shared web hosting', plus free .tk domains are avaliable: http://www.dot.tk/)

Braders
  • 447
  • 2
  • 11
  • Thanks for suggestion. Actually I have some private data which has to be hosted and my company can't trust at this stage and also I have a domain name – rickj Aug 22 '13 at 11:48
  • well you can protect the data with htdocs on a hosted server: http://www.colostate.edu/~ric/htpass.html. – Braders Aug 22 '13 at 12:54
  • @^^^^ Okey thats cool, but I'm scared of losing/duplicate my scripts. – rickj Aug 25 '13 at 06:32
  • Well you can by a public ip address if you really need to; contact your web host for details. – Braders Aug 25 '13 at 06:55
1

Do your company has any vpn network? If it does and you have access to the vpn network, you can include your server to the vpn network and your guest will only need to login to your company vpn network then access your site like in a local network without using port forwarding. And since your data is very confidential, I assume that using vpn will also help to increase the security of your data.

Please correct me if I'm wrong.

Thank You.

yogipriyo
  • 636
  • 8
  • 13
  • actually I don't have personal vpn network. I have tried public VPN, but it did not work out :(. In addition to that I don't want my users to connect to any other network, it should be able to open anywhere like mobile. If there's any other technique, please let me know immediately. Thanks for showing interest. – Rishabh Goyal Feb 05 '14 at 11:32
1

Lets break it into steps.

  1. To host your site locally you will need a IP that is static so that users can access it specifically.
  2. You will need a domain so that it can be converted into user friendly name.
  3. A 24x7 Internet Connection is must! You added a Wifi Router in your Diagram and most of today's router are capable of port forwarding.

What i will do in your scenario is:

  1. Instead of using XAMP, i will install WAMP because i am more familiar with it and easy to configure.(totally personal preference)
  2. Then i would set my server "ONLINE".(Google how to set WAMP server online)
  3. Forward port "80" from router settings to my local computer ip address.(mostly it is tagged as "Virtual Server","Firewall","Port Forwarding",etc vary router to router in settings)

    Suppose you have a local ip "192.168.1.3" and global/router IP "254.232.123.232" then you would redirect all the HTTP request done towards router to your local IP.

    [[[[254.232.123.232]]]] --+ :80 +-- --------->192.168.1.3

  4. That is good for now, but then you will need to tackle dynamic IP problem of router. But don't worry, thanks to some free sites that will be easy!

  5. Go to no-ip.org -> Setup Account -> and create a entry, just a subdomain for now to test whether everything is working fine.(subdomain like mysite.no-ip.org, later purchase a real Domain)
  6. Input your IP address there(Router IP) and download its application which will automatically update their server if your local IP changes.
  7. Wait for some minutes and Voila! Your site is live.
menjaraz
  • 7,551
  • 4
  • 41
  • 81
Kush
  • 755
  • 7
  • 22
  • Thats off the topic, both WAMP and XAMP do the same thing. I have no access to router, I have clearly mentioned that before. In addition to that, there are a lot many servers in between, which can't be configured. So your theory is not valid in my case :( – Rishabh Goyal Feb 08 '14 at 21:13
1

What you are asking is not possible without port forwarding.

nagyben
  • 938
  • 1
  • 10
  • 19