Category Archives: Web Design

Configuring Apache and Bind to support IPv6

Once the basic network connectivity was running, I enabled Apache to support IPv6.

First I added an IPv6 only interface on the VBox Host Internal Network in the Ubuntu server.  The address of this interface is: fdc1:e1f2:425d:2:a00:27ff:fec8:8380

Next I added the following line blow the NameVirtualHost *:80 statement in the /etc/apache2/ports.conf file:

NameVirtualHost *:80
Listen [fdc1:e1f2:425d:2:a00:27ff:fec8:8380]:80

Once the file was updated, I restarted the Apache2 daemon with:

cbroccoli@ubuntuserver:$ sudo apachectl start

Entering netstat -a should show the www service running.  If the interface is not up or if the router is not up, then the apache daemon will not start.

Additionally, bind needs to support AAAA records so that the web server can be accessed by name.

Here I added the following lines to named.conf.local:

zone "broccolifamily.net" { 
 type master;
 file "/etc/bind/db.broccolifamily.net";
 notify no;
 };

Then I added/updated the associated zone file and restarted the bind process:

sudo /etc/init.d/bind9 reload

Everything is working.  nslookup from Windows7 has the following output:

C:\Windows\system32>nslookup www6.broccolifamily.net
Server:  UnKnown
Address:  fdc1:e1f2:425d:2:a00:27ff:fec8:8380
Name:    www6.broccolifamily.net
Address:  fdc1:e1f2:425d:2:a00:27ff:fec8:8380

With Ubuntu, nslookup by itself doesn’t work.  You need to use the -type=AAAA option to get an address back… nslookup -type=AAAA www6.broccolifamily.net.  Putting the name into a browser, however, works without any problems.

How to manage menus in web pages

One of the reasons I started working with CSS was to get rid of my old Frames based web pages.  One of the main benefits of frames was that you could maintain your menus in a single file/frame and the information was valid for all content.  Unfortunately, just be implementing CSS this problem is not solved (although it is often written that CSS is a replacement for frames based web pages).

Thanks now to having been exposed to PHP, I have figured out the last piece of the puzzle… in PHP there are two functions… include() and require().  These two functions will take the  content from another page and place it into your web page.  Without knowing much else, these can be inserted in any page (renamed with a .PHP extension and made executable) and all of the static menu configuration from each page can be placed in the file you call.  This way, one can maintain the menu items in a single file and it will be valid for all content pages.  See the following tutorial for more information… PHP Includes.

Variable passing with require() and include()

Something new… variables are passed to require() and include() from the main page.  So based on the variable you set in the main page, you can return different pieces of code, menu items, etc.

In the main page you set the variable, call the file, and display the output.

<?php
$x=2;
require(“menu.php”);
echo $message;
?>

In the called file, evaluate the variable, set the output variable and return it to the main page.

<?php
if ($x==1)
$message=”Have a nice weekend!”;
else
$message=”Have a \”nice\” day!”;
return $message;
?>

Note that nested quotes need a \ preceeding them.  The code above would put… Have a “nice” day! … in the page.

The switch() function would probably make more sense if more than two or three values are expected.