As far as I can tell, there are two ways to access an Apache virtualhost on a server without a static IP address (i.e. my laptop):
-
Set the host name to foo.localhost in its Apache config file and assign fo.localhost to 127.0.0.1 in /etc/hosts. This makes them memorable but doesn't support clients on the LAN.
-
Listen to different ports. This supports clients on the LAN but makes them hard to remember.
Is there any way to host all virtualhosts on port 80 while making them accessible to other devices? Possibly a reverse proxy that routes 127.0.0.1:80/foo/theactualurl to 127.0.0.1:42908/theactualurl, 127.0.0.1:80/bar/anotherurl to 127.0.0.1:39539/anotherurl?
I'm running Ubuntu 12.04.
Best Answer
I'm a beginner myself, but this came to mind... Can't hurt to try :)
Just set the
ServerName
directive tofoo.localhost
and use theProxyPass
to direct it to a LAN address.Something like:
Then your other internal site is accessed like:
I'll admit, I don't know if that'll work, but it seems reasonable to me ;)
Also, you didn't mention how many computers were on the LAN, but if it's only a few, maybe an edit to the
/hosts
file would be your solution.