Link to another web server on my home network - networking

If I have 2 web servers on my home network, one of which can be accessed via the internet, is there a way to access the other from the internet as well through a link in the first website?

Accessibility from the internet is configured in Your router port forwarding. Web servers use 80 port. I assume this port is forwarded to one of Your web servers local IP address. You could set Your other server on different port, configure Your router and access it, using Your IP adress and the other port.
http://yourip:port/some_page.html

you can use 2 ways:
ports forwarding, like NAT to forward packets from 1st server to 2nd.
using http proxing through .htaccess:
RewriteRule ^access/(.*)$ http://<2ndserver_IP>/$1 [P]
in this example: customer accessing http://1server/access/<anything> link will be proxied to http://2server/<anything>

Related

Access server in local network through domain

i have problem with access to server with domains.
Test url: testpage.example.com.
Server is in local network with port fowarding (80, 443), configured as web server using caddy server as reverse proxy.
Case 1 (using Asus router):
Connected on local network behind router. Server is in the same network as my computer. Everything works like a charm in and out of my network.
Case 2 (using internet provider router):
Connected on local network behind router. Can't access server with domain. Works with direct IP. Outside network, works as in case 1.
I used same server.
Does anyone know why this problem occured? How can i solve it?
Thanks,
David
Two options I can think of:
You could add a record to whatever DNS server you're using in Case 2.
You could write a short script that runs whenever you change network connections to modify your hosts file accordingly.
This happens when the server you are trying to reach "testpage.example.com" resolves to your router's external IP address. Because your public IP address is the same as server's IP address (even though inside your home network you have different private IP addresses) your requests are lost in the ether.
As a workaround you can resolve the testpage.example.com manually on your local machine.
For Windows c:\windows\system32\etc\hosts
For Linux /etc/hosts
testpage.example.com 192.168.1.102 -> private IP of the machine serving the site.

Port-forwarding and website hosting: Two domains, same ip, different computer

So I have two domains:
http://firstexample.com
http://secondexample.com
on my router I currently have portforwarding so that when someone goes to http://firstexample.com, they see the website that my computer with internal IP 192.168.0.15 is hosting
How can I set it up so that if someone goes to http://secondexample.com, they would see the website that my other computer, with internal ip 192.168.0.16 is hosting?
Both of my computers have the same public IP.
Is it a setting on my router I would change? Or would godaddy allow me to configure something?
No it is not possible to listen for two domains on the same IP/port configuration, using just Layer3/4 functionality alone. Most of the web servers do it based on the Host field in the request. If you are okay with using two ports on your router, that's possible eg. you can do something like following port forwarding
<router_ip>:80 -> 192.168.0.15:80
<router_ip>:8080 -> 192.168.0.16:80
But the problem with that is anyone trying to access http://secondexample.com should always access it as http://secondexample.com:8080 which is very inconvenient.
Here's another alternative you can do -
run a webserver on say 192.168.0.15 like nginx or something and create two backends one for each http://firstexample.com and http://secondexample.com . Refer nginx docs for how to do it. You'd not need three machines for that firstexample.com can run on 192.168.0.15 (except not on a standard port 80 but on a port 8080 say) and secondexample.com would run on another machine. And then add only following entry on your router port forwarding
<router_ip>:80 -> 192.168.0.15:80 # assuming ngninx is listening on port 80.
I am assuming both firstexample.com and secondexample.com do resolve to your router IP address.

Accessing WAMP server from a different network

I was trying to setup WAMP server on my machine . Am able to access the localhost from the same PC or remotely from other devices in the same network .
However I would like to know how can I access it from a different network ?
Check the port 80 forwarding on your router. Forward port 80 of that particular machine/server to your router. That server should have a permanent local IP like 192.168.1.* or 192.168.2.*, etc whose port 80 is forwarded to the public IP of your router. This provides access to your server/machine with the set IP from outside your network!
For router settings, open a browser, in the location bar, type http://192.168.1.1 or whatever your router manual says it to be. You will need the default user/pass to login.
In order to have a permanent access to your home server with a domain, You need to get a permanent public IP for your network from your Internet service provider in order to assign a domain name to it.

Port forwarding

I have a simple requirement of hosting a webserver on my computer. But unfortunately, the internet connection provided by my employer has only ports 21 & 80 open. Rest of all the ports are closed. I tried port forwarding for ports 80 and 21 but they are already in use by my employer itself. So, is there any other way of hosting a webserver on my computer?
P.S.: I am on linux with Apache.
Does the firewall run an HTTP proxy, or is it just a simple port forwarder? If it's a proxy, it may be able to forward to different internal IPs based on the Host: header, similar to the way virtual web hosts operate.
If not, you won't be able to use these ports. A NAT router can forward a port to only one IP. If hosting the webserver is a job requirement, as you say, you should be able to contact the network administrator and get another port opened for it. If they won't do it on your request, your manager should be able to confirm the requirement.

Asp.Net IIS hosting

I have an asp.net web application hosted iis on LAN. When i type in my local ip address in the URL box, i can access it. My question is, if i want to access it from outside the LAN, would i have to port forward it to port 80? And intead of typing my local ip address in the URL box, i would now have to type the routers ip adress??
Use your internet and LAN address.and put a net forwarding in firewall or port 80 for your internet address.and yes you need to make changes in your firewall as well.
Yes. If your internet address is 7.7.7.7 and your LAN address is 10.10.10.10 -- you'll need to put a NAT/Port-forwarding entry in your router/firewall to send traffic on TCP Port 80 destined for 7.7.7.7 TO 10.10.10.10. On most home routers this is a pretty simple task.

Resources