Host website without public IP
I have installed LAMP stack. I have an internet connection. My ISP has given me a static IP, but it is not public. I have a TP-LINK router. I have a registered domain. Now, I want to host my own domain in my desktop that can be accessible from the outside world.
Edit:
Below are the posted router configurations. When I registered the domain, I was asked whether I merely wanted the domain registered, or also wanted their web-hosting service, and I only agreed to register the domain only.
About the WAN status in the following image, when I clicked the Detect button, it detected WAN Connection Type as Dynamic IP. So I selected Dynamic IP from the drop-down list and changed the DNS Servers to 8.8.8.8 and 8.8.4.4 then saved the settings and rebooted the router, but I cannot browse the web this way. So, then I changed the settings as given in the image below as before and was able to browse again. How to configure the settings below, so that when I type my domain name from any device connected to the internet, I get the website that is being served from my /var/www/html/ folder. How to configure Apache or whatever. Please ask me any questions you need to help. I badly need my own server running although I shall use it for personal use. Thanks in advance.
Solution 1:
As you don't have a fixed or dynamic public address that you have control over, you'll need your ISP to port forward from the public address to your router. And then from your router again to your web server.
If your public address (search on-line for "what's my IP?") on the other side of your ISP's router is not static (as in it periodically changes), then you will have a further problem as your public address will keep adjusting. But this could be rectified with a dynamic DNS service.
I'd firstly talk to your ISP. Explain that you want to expose a web service on the Internet from your home server.
An alternative could be to use a reverse SSH tunnel. You connect to a server on the Internet from your web server and set up a reverse tunnel. All web requests to the remote server are then mapped back to your web server through the tunnel. There are many howtos for this available on-line.
Or you could place your files elsewhere on the Internet with web hosting. And periodically publish. This may be more secure than putting your home server on-line.
Solution 2:
If you only have a static local IP then you can use a service and an application to have a roaming website.
Basically you install an app that will notify dyn what your IP has change to and they change the hostname they have given you. http://dyn.com/dns/
Not sure if this will work with your current registar, but you can move your domain to them and it works perfectly.
Also lots of utilities exist in the repos that will help with the service provider
apt-cache search dyndns
Solution 3:
Your ISP gave you a static local IP address, which you could have done yourself. Unless you have no internet connection, you always have a public IP, but that IP is dynamic, meaning it changes periodically. What you want to do is set up a port forward. Most routers are capable of port forwarding, so this shouldn't be a problem for you. I can't give further advice than checking your router's web setup, as you haven't provided the actual model. If your router does have port forwarding, you need to forward ports 80 and 443 to the local IP address of your server.
Next, you'll want to set up a No-IP account and set up the DUC (dynamic update client). This will assign a sub-domain address to your public IP. The DUC is needed so the address you register with No-IP can keep referring to your public IP, even when it changes.
Once you have port forwarding and No-IP set up, you can now set your domain to point to the No-IP address. You should be able to do this using a masked redirect, or DNS.
You may have a problem though. Most ISPs don't want you running a home web server, and they usually block incoming connections on port 80. If this is the case, you'll need to set the server to run on some other port than 80. Good luck.