Search code examples
djangodevopsportforwardingdeploying

I can access the website locally but can't access it through the internet After openning the port


I want to make my phone a Linux web server, by using the userLand application which gives you the ability to use ubuntu distribution on Andriod.

I already installed Django and ran my server on port 8080 since port 80 is busy (seems logical that android is using it)

and everything is good, it works when I try to access the website from another device on the local network.

so I proceeded to the next step which is making the website accessible from all over the internet then I found that you need to make a port forwarding on the router to allow devices from outside the local network to access a device in the localnetwork .

I followed the following steps :

  1. made the phone's IP static locally
  2. added the configuration needed for the port forwarding (phone's ip, port 8080, etc... )
  3. found the public IP for my phone and used it and with port 8080

it is still not working: I can access the website locally but can't access it through the internet.

I tried another method by using an already working server from the "AWebServer" application on google play

but still the same problem.

I tried temporarily to disable the firewall on the router but still the same problem

and finally, I tried to open the port on my laptop with OS: Windows 10 instead of the phone OS: Android, and checked with port checker but the port is closed and still the same problem.

I have been trying to solve this for a whole day)), I would be very happy if someone helped me.

thanks

first image

second image


Solution

  • Your ISP might have put you under a NAT, in that case port forwarding might still not work.

    Your best bet is to use some sort of SSH Tunnels.

    You can try with ngrok.

    This will give you a URL to access your application from public internet.

    Only caveat here is that ngrok is not free. They have a subscription based model. In the free tier, you can use ngrok but the link url changes after few hours.

    If you want to, you can also implement something like ngrok for yourself. Read about ssh tunneling more. This will help you.