Apache Configuration File Edit

Once you have installed the main components described previously, you should now edit your httpd.conf file. In our test case, located in /usr/local/apache/conf/httpd.conf.

In our case we copied midgard-data.conf from my midgard-data-1.4 source directory to our apache/conf directory and inserted an Include directive in our Apache configuration file (httpd.conf) to point to it.

Include conf/midgard-data.conf

so we can perform all of our Midgard virtual host configurations in a separate file.

The basic objectives here are:

We have set the Virtual Hosts on different ports on the same IP address. This to keep things fairly simple.

We created four different Virtual Hosts on our test server:

If you are following these instructions and want to set up your test server on the network simply substitute 127.0.0.1 with your server's IP address.

Below are the additional lines within our httpd.conf


	
LoadModule midgard_module     libexec/mod_midgard.so
		
	

Installation of the Midgard Apache Module (mod_midgard) will have automatically added this line into your httpd.conf file.


	
LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php4 .phtml .php4 .php
	
	

The Midgard-php installation adds the first two lines automatically to activate PHP. The third line should already be in and only needs to be uncommented.


	
Include conf/midgard-data.conf
	
	

This in effect makes your midgard-data.conf file an integral part of the httpd.conf file.


	
MidgardDatabase <midgard> <midgard> <midgard>
AddType application/x-hhtpd-php-midgard .mgd
MidgardTemplate phpelements.xml
MidgardRootFile libexec/midgard-root.php4

Listen 80
Listen 8099
Listen 8101
Listen 8102
	
	

Tells Apache to listen for http requests on four different ports. Port 80 MUST be included as well. Otherwise, Apache simply does not respond.


	
NameVirtualHost 127.0.0.1:80
NameVirtualHost 127.0.0.1:8099
NameVirtualHost 127.0.0.1:8101
NameVirtualHost 127.0.0.1:8102
	
	

This is to activate virtual hosts on the server's IP address on the various designated ports


	
<VirtualHost 127.0.0.1:80>
ServerName www.mydomain.com
Port 80
DocumentRoot /usr/local/apache/htdocs
</VirtualHost>
	
	

This sets up our normal non-Midgard site. Note that once you have set up Virtual Hosts, then even your normal Port 80 web-site must be included as one of the Virtual Hosts. Therefore in here you can include whatever Apache directives you deem necessary. But the most important directive is to indicate your document root.


	
<VirtualHost 127.0.0.1:8099>
MidgardEngine on
ServerName www.mydomain.com
php_value magic_quotes_gpc off
php_value magic_quotes_runtime off
</VirtualHost>
	
	

This now allows us to view the old Example Site, Virtual Midgard Using Company, which will have been included if you chose to install the old Admin Site.


	
<VirtualHost 127.0.0.1:8101>
MidgardEngine on
ServerName www.mydomain.com
php_value magic_quotes_gpc off
php_value magic_quotes_runtime off
</VirtualHost>
	
	

These lines will create a virtual host for the old Midgard Admin Site. With this you can simply call up the site by typing www.mydomain.com:8101/admin.


	
<VirtualHost 127.0.0.1:8102>
MidgardEngine on
ServerName www.mydomain.com
MidgardBlobDir /usr/local/apache/htdocs/blobs
php_value magic_quotes_gpc off
php_value magic_quotes_runtime off
</VirtualHost>
	
	

These lines will create a virtual host for the Asgard Site, the new administration interface which supports all the features of Midgard 1.4. Please remember to set the MidgardBlobDir directive, otherwise you will not have any images in the Asgard Site. With this you can simply call up the site by typing www.mydomain.com:8101/admin. Note that Midgard sites do not need DocumentRoot directives.