PC Plus HelpDesk - issue 218
This month, Paul Grosse gives you more insight into some of the topics dealt with in HelpDesk From the pages of HelpDesk, we look at:
- Wide Angles with Digital Cameras;
- Coloured Fringes on Digital Images; and,
- Apache Log Entries - Whois Databases
From HelpDesk Extra, we look at Multiple servers on one machine:
- Domain names;
- Name-based virtual hosts;
- Mounting drives in Linux directory structures;
- Security; and,
- External access.
HelpDesk
Apache Log Entries - Whois Databases
If you don't get any luck getting a friendly domain name from nslookup/ host, try using the following to get the domain name:
General links to databases at ICANN http://www.icann.org/ IANA http://www.iana.org/ the RIPE database for European domains http://www.ripe.net/ the APNIC database for Asia Pacific http://www.apnic.net/
http://www.apnic.net/apnic-bin/whois.plthe ARIN database for North America and Sub-Saharan Africa http://www.arin.net/
http://ws.arin.net/cgi-bin/whois.plthe LACNIC database for Latin American and Caribbean http://lacnic.net/
HelpDesk Extra
Domain Names
If you have not got your own domain name, there are sites that will let you add your own choice in front of a variety of ther own - working your way down the DNS tree.
One such site is DynDNS.org http://www.dyndns.org/ which will let you have five free domain names (as long as nobody else has got there first).
DynDNS offeres a dynamic and static service. The static service offers the same as the dynamic one except that it is for people whose IP address stays the same. If your IP does change with the static service, you can change it to the new IP address although this can take a few days to filter through the system.
For the purposes of this HelpDesk Extra, I have created a number of URLs from info2.mine.nu using the wildcard attribute at DynDNS. So, as *.info2.mine.nu is being directed at my IP address, I can (and have) set up virtual hosts for: http://www.info2.mine.nu/ , http://www.pauls.info2.mine.nu/ and http://clear-the-drains.info2.mine.nu/ which all run off one server. below gives you some extra information on how to create and check this over what is in the magazine.
Name-based Virtual Hosts
In section 2, you defined the default server configuration. Here...
### Section 3: Virtual Hosts...you let the server know about other websites you want to run of the server.
Virtually any directive that can be found in section 2 can be put in here and if you want to play safe, you can add a few that are already there such as denying WebDAV and so on
This is the section in full (with just three additional vhosts)
NameVirtualHost * <VirtualHost *> ServerAdmin me@myisp.co.uk DocumentRoot "/srv/www/htdocs" ServerPath "/srv/www/htdocs" ServerName server1.workgroup ServerAlias server1 Server1 Server1.workgroup ErrorLog /var/log/httpd/s1error_log CustomLog /var/log/httpd/s1access_log combined </VirtualHost> <VirtualHost *> ServerAdmin me@myisp.co.uk DocumentRoot "/srv/www/mydomain" ServerPath "/srv/www/mydomain" ServerName www.mydomain.co.uk ServerAlias mydomain.co.uk *.mydomain.co.uk ErrorLog /var/log/httpd/mderror_log CustomLog /var/log/httpd/mdaccess_log combined </VirtualHost> <VirtualHost *> ServerAdmin meagain@myisp.co.uk DocumentRoot "/srv/www/myotherdomain" ServerPath "/srv/www/myotherdomain" ServerName www.myotherdomain.co.uk ServerAlias myotherdomain.co.uk *.myotherdomain.co.uk ErrorLog /var/log/httpd/moderror_log CustomLog /var/log/httpd/modaccess_log combined </VirtualHost>This breaks down as follows:
NameVirtualHost *tells the server not to associate the hosts with any particular IP address <VirtualHost *>starts a virtual host block - internally accessible host ServerAdmin me@myisp.co.ukdefines the server admin contact details if you want that to be different for each vhost. If, for example, you wanted to have mail go to somebody completely different, somewhere else on the planet. DocumentRoot "/srv/www/htdocs" ServerPath "/srv/www/htdocs"These tell the server where to serve the files from. There is a difference in interpretation between the two but if you include both, you are covering yourself. ServerName server1.workgroup ServerAlias server1 Server1 Server1.workgroupThese are the names that you think are likely to be entered by your user population. In this case, it is the long form of the LAN name of the server followed (as aliases) by the other names it is likely to get called (or at least the ones it stands a chance of recognising) ErrorLog /var/log/httpd/s1error_logThis is where the errors for this domain are sent CustomLog /var/log/httpd/s1access_log combinedThis is the access log and you can define the format for it here as well - it need not be the same as the other logs, as long as the form is defined in the rest of the httpd.conf file so that Apache knows what you are talking about. It pays to be standard though as this makes it easier for server stats programs such as Webalizer to understand it. Also, being a log file for just one server, you can look at how people navigate through your sites individually. </VirtualHost>ends a virtual host block <VirtualHost *> ServerAdmin me@myisp.co.uk DocumentRoot "/srv/www/mydomain" ServerPath "/srv/www/mydomain" ServerName www.mydomain.co.uk ServerAlias mydomain.co.uk *.mydomain.co.uk ErrorLog /var/log/httpd/mderror_log CustomLog /var/log/httpd/mdaccess_log combined </VirtualHost>This is the same as above but uses a server name www.mydomain.co.uk that is accessible from the outside (Internet) You can carry on defining as many hosts as you like as long as you have the memory and disk space to do so.
Mounting Drives in Linux Directory Stuctures
One advantage that Linux has over Windows is that if you decide to increase the amount of disk space that is available in a certain area, you can do it just by mounting it there.
In the tree on the right, you can see that the /srv directory is one partition but mounted within that is another partition called hcam. This is configured in the fstab file in /etc. In this case, it is an smb mount from another machine but there is no reason why you cannot use it to mount another drive (just imagine what you could to with 250GB of web space) that is physically in the same machine.
Being able to do this has the effect of not necessarily requiring you to change your httpd.conf file in order to accommodate this (if, for example it was part of an existing website).
Security
You must remember that you should protect your servers with at least a firewall and preferably, it should run on a machine on its own.
Configure your firewall so that it allows port 80 through and directs it all at your web server - something like the following:
Action Service Source Destination Time Day Enable Allow Web (HTTP) WAN 10.23.16.9 (HomePort) so in this example, all inbound port 80 traffic is directed at host 10.23.16.9
External access
One little problem you will have is that unless you start messing around with your DNS on your LAN, you will probably not be able to see your virtual sites from the Internet.
One solution to his is to use a proxy so that your browser connects to the proxy and the proxy connects back to your site.
Whilst this can be achieved without graphics by asking Google to translate a site for you, there are some sites that are set up to allow anonymous browsing but can be used to check your site's virtual websites. One of these is Proxify ( http://proxify.com/ ) and it will let you see your images so, if you have forgotten to make them readable to others, their failure to appear will be seen by doing this.
Remember though that if you want to test out password access, you should set up a temporary password for the purpose and delete it (or configure it out) afterwards.