Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a home web server which is constantly running. Is it possible to create a subdomain which would redirect traffic to another local PC?

For example, I have one Server and one notebook (with web server installed for developing). Now I can access to notebook only from local network with IP. Server is also hosting domain example.com. Now I would like to visit "laptop.example.com", which would be my laptop.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you own 'example.com' you can create a subdomain A-record to point to its local IP (192.168.1.X or 10.0.X.X) and then access it that way, or you can make up an 'example.com' you can edit the (PC?)'s hosts file (C:\Windows\system32\drivers\etc\hosts) and create a new entry at the bottom like so:

192.168.1.X laptop.example.com

And any time you access laptop.example.com on that computer, it will route to the laptop. You need to make sure also that your laptop allows inbound connections to it, so check out any firewall entries that may need to be modified.

With this, nothing will be accessible from outside your local network. Comment if you have questions.

If you are trying to get your laptop's server to run publicly too, you'd need to either have it run on a separate port publicly, or you use what's called a reverse proxy to proxy the content via your other server. This can be done in Apache very simply:

<VirtualHost *:80>
     ServerName laptop.example.com #publicly set in DNS
     ProxyRequests off
     ProxyPass / http://192.168.1.X:80/ #local IP of laptop
     ProxyPassReverse / http://192.168.1.X:80/ #same as above
</VirtualHost>

What webserver software are you running?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.