0

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!

NickPatt
  • 3
  • 2

1 Answers1

0

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.

anthonysomerset
  • 3,983
  • 2
  • 20
  • 24
  • Thanks for the response. I am using a Mac standard DNS. From the Server Admin program I have a zone of type master called mysite.org and I created a record of type A (Address) from "staff" to the ip of the intranet server. Is there anything that I need to do in addition to this? –  Feb 28 '11 at 16:36
  • you will need to make sure your network sets your mac server as the dns server and that it is also configured to perform recursive (forward) lookups for the lan, also make sure any other records for that zone are also included in your local setup, otherwise your main website will stop working inside the network (and emails etc) – anthonysomerset Feb 28 '11 at 17:23
  • After looking at my DNS I now have the virtual host working properly inside my network. However, I still cant connect from outside. I have everything set up internally on my DNS machine including other working virtual hosts. Some work both internally and externally but I have noticed a couple now including staff which only work internally. What is different on the machines that are working outside the network? Any help would be greatly appreciated. – NickPatt Feb 28 '11 at 23:01
  • then you will need to port forward from your router to the internal IP, also external dns will need to use the public IP of your internet connection rather than the internal IP – anthonysomerset Mar 01 '11 at 08:09
  • That is where I am running into issues. I have I Sonicwall router with a built in firewall. I have followed these instructions on the Sonicwall site to make my servers public. http://www.fuzeqna.com/sonicwallkb/consumer/kbdetail.asp?kbid=7027 I went back and checked that the settings are the same as other servers that are public and working properly and they are. but when I test the intranet server it is still not reaching outside the network. I may need to contact Sonicwall, but if anyone has any ideas please let me know. Thanks! – NickPatt Mar 01 '11 at 16:10
  • Ok, so I Was able to tweak my firewall settings to make the site public. I needed to change the port number because although it was on a different macine the public ip was the same as my existing web server. Now I can access the site from outside the network by typing in my ip adress and the port. However, the virtual host is still only working internally. Any thoughts on how to correct this? – NickPatt Mar 02 '11 at 22:12
  • is it also working by IP? it looks like you have 3 or 4 vhosts for the same site, it would be good to reduce it down to one, the first one in httpd-vhosts looks good just get rid of the listen 9000 line – anthonysomerset Mar 03 '11 at 07:57
  • Yeah, so inside the network I can go to staff.mysite.org:8080 and access the site. From outside the network I can access the site by typing the external ip:8080 in the url bar, but if I try staff.mysite.org:8080 outside the network I cannot connect. Yeah kind of overkill with the virtual hosts I was trying several things to try to get it working. I cut it down to just the httpd-vhosts file and got rid of listen 9000. Still having the same problem. – NickPatt Mar 03 '11 at 13:33
  • wherever you manage the dns outside of your network you need to setup the A record for staff.mysite.org with the public IP of your network - this wont get rid of the need to use port 8080 though, only a second public IP (if your router will support the routing) or a reverse proxy on your main site will solve that – anthonysomerset Mar 03 '11 at 14:31
  • Ok I got everything working now. Created a new external ip for the server so that I can use port 80 and added the virtual host to the external DNS everything works right now just waiting on the changes to take effect and then I should be good to go. Thank you so much for all your assistance. It really helped a lot. – NickPatt Mar 04 '11 at 18:32