Virtual Host Joomla and MAMP

hostjoomlamampvirtualization

I have been trying for some time now to set up a virtual host for the new Intranet we are putting in at my organization. It is on a separate server from the one running our website. I have set up the Intranet using MAMP and Joomla on a Mac OSX 10.5.8 machine.

I have followed several tutorials and solutions including Virtual Host X but nothing seems to work.

I am able to get the virtual host to work on the local machine but nothing outside of that.

Here is an example of my hosts file.

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1            localhost
127.0.0.1           staff.mysite.org
255.255.255.255 broadcasthost
::1                 localhost 
fe80::1%lo0         localhost

The end of my httpd.conf file looks like this. There are two includes. The first was my original attempt to set up a virtual host. The second created by Virtual Host X

NameVirtualHost *:80

Include /Applications/MAMP/conf/apache/vhosts.conf

Include /private/etc/apache2/extra/httpd-vhosts.conf

Here is my vhosts.conf file.

<VirtualHost *:80>
ServerName staff.mysite.org
DocumentRoot /Applications/MAMP/htdocs/joomla/
DirectoryIndex index.php index.html index.cgi
<Directory /Applications/MAMP/htdocs/joomla/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>

Here is the httpd-vhosts.conf file.

NameVirtualHost *:80
Listen 9000

<Directory "/Applications/MAMP/htdocs/joomla/">
Allow From All
AllowOverride All
</Directory>
<VirtualHost *:80>
ServerName "staff.mysite.org"
ServerAlias "www.staff.mysite.org"
DocumentRoot "/Applications/MAMP/htdocs/joomla"
</VirtualHost>

<VirtualHost *:9000>
DocumentRoot "/Applications/MAMP/htdocs/joomla"
</VirtualHost>

I read on the Joomla support site that you have to make a change to the $mosConfig_live_site variable in the configuration.php file, but when I make the suggested change it still does not work and I can no longer view the site on the local machine.

Is there something I am missing here?

Please help if you can. Thanks!

Best Answer

your missing some DNS configuration

you need to have a dns record that will translate staff.mysite.org into the IP address of your server, if you are running internal dns then this is no problem, and it totally depends on your local dns configuration, 2 examples:

if your running a firewall like pfsense with dns forwarding, you can setup a single dns record that will send staff.mysite.org to the IP of your intranet server

if however you are running standard dns servers like Apple's or Windows DNS then you will have to locally create the zone for the whole domain and replicate the current values found on the internet and then add the staff subdomain with the local IP.