Intranet / Own hosting

Moderator: mcsmom

Post Reply
User avatar
RobInk
Joomla! Guru
Joomla! Guru
Posts: 517
Joined: Thu Aug 18, 2005 10:41 am
Location: The Netherlands

Intranet / Own hosting

Post by RobInk » Tue Apr 25, 2006 9:37 am

Hi,

I'm seeing a reoccuring question when people host there site on there own PC at home. Or run it on an Intranet. The reoccuring problem is that withing there own network they can view there site okay, but outside there own network they can not. In most cases the stylesheet and/or images will not load.

Kenmcd has found a solution here: http://forum.joomla.org/index.php/topic ... #msg260555

Would this summary and link make a good FAQ?

Thanks Robin

hosts file
The hosts file is where you would make settings which point that particular machine to the domain inside the intranet.
For example, on your machine where you are running the actual server
127.0.0.1  joomla.domain.nl
For other machines pointing to your machine, replace the IP address with your internal IP address.
192.168.32.10  joomla.domain.nl
Replace 192.168.32.10 with your server internal IP address.

Each computer must be restarted for the hosts file changes to take affect.
Then internal users would also access the site by http:// joomla.domain.nl.

Note: The lmhosts file has the advantage of being possible to centrally administer, but it does require other configuration changes.
Also , your company internal intranet may be running it's own DNS which would allow this setting to be made there instead of in each computers' hosts file.
But . . . for small local or home networks, using the hosts file is easy.

mos_livesite
This hack allows you users to access the site with whatever domain used to access the site.
$mosConfig_live_site = 'http://'. $_SERVER['HTTP_HOST'];
This allows you to point multiple domains to the same server.
Warning: You cannot access the configuration file from the J back-end or the setting will be lost.

Note: this is not needed for the hosts file solution above.
Last edited by RobInk on Mon Sep 25, 2006 5:52 pm, edited 1 time in total.
Regards Robin - Sites & Infrastructure

Arthur P

Re: Intranet / Own hosting

Post by Arthur P » Sat May 13, 2006 9:05 am

This issue stumped me for days. And with more and more broadband access this really should be close to the top of the FAQ list among the Start here FAQs.

My setup may actually be a bit more complex than most. My server sits behind 2 routers, each of which are doing some address translation. All Internet originated http requests are of course forwarded to the server's fixed IP address on the Intranet.
In addition I'm currently still testing: I do have an external IP address but I don't have a domain name yet. So seemingly the DNS server on the router wasn't 'learning' to redirect on its own. And Joomla is located in a subdirectory ./joomla under the web root directory, with a live simple html site having it's root in the web root.

With different ways of entering the $mosConfig_live_site address I could get the site to work partially. Either the site itsself would seem OK from both Internet and Intranet but the admin section would not work properly, or vice versa, or neither. For some reason all of Joomla! simply would not properly swallow identifying the root in the live address as '.' or '../joomla'.

I eventually solved the internal/external IP address issue by looking at the routers. I simply adding an IP forwarding line onto the internal router:

  • External IP address = the IP address which you would point to if you were trying to reach your server from the Internet (IP.address.internet.joomlaserver)
  • Internal IP address = the IP address you would use if trying to reach your server from the Intranet (IP.address.intranet.joomlaserver)

In addition in config.php I changed the following line: 
  • $mosConfig_live_site='http:// ip.address.internet.joomlaserver/joomla';

So the live site directive is now pointing to your external internet address.

What this does is that your server will try and get to the internet address to get parts of a page, but will then be redirected to itsself by the router. Server fooled, Joomla fooled, and everything now seems to work correctly.
Last edited by Arthur P on Sat May 13, 2006 9:09 am, edited 1 time in total.


Post Reply