1

I would like to have others inside my local network access resources on my computer at outsideprojects.192.168.0.10. I am running Apache and have a virtual host configured so I can access it at outsideprojects.localhost but can't seem to be able to access it from the outside.

I have all firewalls disabled so I don't believe that this is the issue. I would expect that I should be able to access this at outsideprojects.127.0.0.1 but I cannot do that either.

What are the Apache configuration options to be able to accomplish this?

Icode4food
  • 175
  • 1
  • 2
  • 13

2 Answers2

3

This isnt an Apache thing, Its DNS

add the following to C:\Windows\System 32\drivers\etc\hosts (for windows) or /etc/hosts (*nix systems)

192.168.0.10 outsideprojects

You will have to do this on every PC you want to allow to use the URL

you will then be able to use : http://outsideprojects in your browsers

Geraint Jones
  • 2,483
  • 16
  • 19
  • I know am aware of the solution that you suggest and I don't want to do that for the very reason you suggest. My thought was that there isn't any reason that the folks in my local network couldn't use my ip address with a subdomain. That way there is no reason for needing to set up the dns like you suggested. – Icode4food Oct 09 '10 at 01:08
  • there is a very simple reason they cannont, IP addresses have no concept of a subdomain. a subdomain is a part of DNS (Domain Name System) 192.168.0.10 < thats an IP address and the local reolver on your PC doesnt even try to use DNS for it. outsideprojects.localhost < thats a hostname and the local resolver resolves it to 127.0.0.1 - you cannot mix the two together. – Geraint Jones Oct 09 '10 at 01:12
  • BUT - if they are going to enter : `http://outsideprojects.192.168.0.10` why not just make outsideprojects the default VHost on that IP and have them enter `http://192.168.0.10` – Geraint Jones Oct 09 '10 at 01:14
1

As c10k Consulting pointed out, IP addresses have no concept of subdomains. You have a few options:

  1. You can setup a host file on all the machines that need to be able to access your local machine
  2. If you only have one vhost that you want people to be able to access, you can configure it to be the default vhost and have others just browse to the IP.
  3. You can create a single default vhost and add aliases to it. For example, you could add an alias for "/foo" that points at "/path/to/foo" and a separate alias for "/bar" that points at "/path/to/foo". This method requires mod_alias, which I believe is enabled by default on most systems.
  4. You can setup an internal IP address on your DNS server. For example, if you control example.com, you could add an A record for foo.example.com that points to 192.168.0.10. This would, of course, only be available from within the network.
JamesArmes
  • 205
  • 3
  • 9