Primary Default Website in Virtualmin (Apache)

When no virtual websites are in existence, The Apache web server will point to /var/www/html and /var/www/cgi-bin in a base install of Virtualmin (the default). However when a Virtual website is created, this changes to the first available virtual site, so for example, if the hostname is some.domain.com and no virtual sites are configured, typing this URL in a browser will serve the content in /var/www/html. If a virtual site called virtualsite.com is created, the same request will serve the content of /home/virtualsite/public_html.

By design this is normal

Whilst this is the way Apache is designed and there’s nothing wrong with that, it becomes a problem when some applications are only available outside the virtual server realm (i.e. not suexec’ed). For example the server has Nagios or Munin installed and you want to be able to access it even after a virtual server has been created. The solution is to manually create the first virtual server and call it the same as the server hostname (some.domain.com).

Continue reading Primary Default Website in Virtualmin (Apache)

SSL smtp on Virtualmin

By default, virtual servers aren’t setting up SMTP to use SSL. Following this information regarding SSL SMTP I am just summarizing:

 netstat -an | grep :465

Returns nothing, so.

vi /etc/postfix/master.cf

find the lines:

#smtps inet n - n - - smtpd
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING

And uncomment them:

Continue reading SSL smtp on Virtualmin

index.shtml and #include virtual in Virtualmin

For some reason the default virtualmin install does not have index.shtml in the Directoryindex directive. To enable it, one must edit the directive:

Virtualmin > Services > Configure Website > Edit Directives 

Find the following line:

DirectoryIndex index.html index.htm index.php index.php4 index.php5

Add index.shml at the end  of the line:

DirectoryIndex index.html index.htm index.php index.php4 index.php5 index.shtml

Click “Save” then “Apply Changes” (on the top right hand side of the “Virtual Server Options” page). Checking your virtual website will show the index.shtml page.

To make it a default configuration

In order to enable  this for all further virtual websites:

Continue reading index.shtml and #include virtual in Virtualmin

Virtualmin Virtual Servers (GPL)

Following my last post I now found out that Webmin does not allow multi virtual servers :-(, BUT there is a module called Virtualmin Virtual Servers (GPL) which is what I need.

To save myself hassle, I installed a compatible OS (CentOS 6 64bit) and simply installed virtualmin from the install.sh command after downloading it:

cd /root
wget http://software.virtualmin.com/gpl/scripts/install.sh
sh ./install.sh

After this my next  move was to install csf lfd from configserver.com:
(there is now a new URI for the archive which I changed on 2017-02-08)

wget http://www.configserver.com/free/csf.tgz
wget https://download.configserver.com/csf.tgz
tar zxvf csf.tgz
cd csf
sh ./install.sh

Once installed integrate it in Webmin and you’re good to go.

– Install the csf webmin module in:
Webmin > Webmin Configuration > Webmin Modules > From local file > /etc/csf/csfwebmin.tgz > Install Module

Email access problems

All worked well from the word go except SMTP/POP3 (Dovecot) server; I was getting Failed to connect to localhost:143 : Connection refused  (as well as port 993,995,110 and 25) when trying to connect either via my email client or usermin.

System Information was reporting that Dovecot IMAP / POP3 Server was offline, and trying to start Dovecot failed:

Starting dovecot: Error: socket() failed: Address family not supported by protocol
Error: service(pop3-login): listen(::, 110) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(pop3-login): listen(::, 995) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(imap-login): listen(::, 143) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(imap-login): listen(::, 993) failed: Address family not supported by protocol
Fatal: Failed to start listeners

After editing the /etc/dovecot/dovecot.conf file and commenting out/insert: listen = *  Here is how my edited file looks like:

# A comma separated list of IPs or hosts where to listen in for connections. 
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
#listen = *, ::
listen = *

Now, why would Dovecot server come with this line disabled is baffling, anyway, after this, Dovecot starts fine allowing usermin and email clients to connect without problems:

dovecot

 

Server heartbeat

This little perl program allows you to check the availability of an IP address via a cron command that outputs the result in a text file.

#!/usr/bin/perl
# This script pings IP addresses
#
# In a live application, read host list
# from a config file
@hosts = ("192.168.1.1","192.168.1.19");
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon += 1;
$min = sprintf("%02d", $min);
$sec = sprintf("%02d", $sec);
$mon = sprintf("%02d", $mon);
$mday = sprintf("%02d", $mday);
$year = sprintf("%02d", $year % 100);

@live = ();
foreach $h (@hosts) {
        $r = `ping -c2 $h`;
        if ($r =~ /2 re/) {
                push @live,$h;
                }
        }
$alive = "@live";
print ("You have $alive on $mday $mon $year @ $hour:$min:$sec\n");

This script can then be used in a cron like:

*/5 * * * * /path/to/file/pingtest.pl >> /some/path/pingtest.txt

This command will write the result on a new line in the file called pingtest.txt every 5 minutes. Which will look like that:

You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:05:01
You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:10:01
You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:15:01

Plesk panel, backup strategy when low in space

Plesk backup is a real pain in the backside, if your server disk space is limited, even when choosing to backup in a ftp repository. All the files are created locally and then send over via ftp.

Prerequisites

Note that in order to implement this backup strategy, one must have an external backup space available like rsync.net (which I use) so that you can use the “rsync” command to transfer your files.

Minimising disk usage

In order to exclude any gigantic compressed (or not) archives being stored in your local hard drive, here is a little guide to help you avoid filling your server disk.

The first thing to backup regularly is the Plesk server configuration, this backup will not save the websites/email/database data but the content/configuration of your Panel, which is the first thing to restore if your server packs up.

Backing up Plesk (11) configuration

  1. Open your Plesk Panel as Admin
  2. Choose Tools & Settings from the Server Management sub-menu
  3. Click on Backup Manager
  4. Select Scheduled Backup Settings
  5. Activate the scheduled backup
  6. Select Store backup in: Server repository (or you can chose ftp there also as the files aren’t big, a couple of MB’s)
  7. I have set the Maximum number of backups in repository to “3”, but you can choose another value here
  8. Under the Backup content section, select  “
  9. Press OK

Obviously the choice of Schedule and prefix is at your convenience, I personally back up every day at 00:10 and the prefix is set to “configuration”.

If you aren’t using ftp, the content of this backup is stored in the /var/lib/psa/dumps/ directory. So in order to backup this on another server, simple rsync this location with a command that could be:

rsync -avz /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps

If you don’t want to keep aggregated data add the –delete option:

rsync -avz --delete /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps

To automate

To automate all this simply stick it in a cron (one can use the “Scheduled Tasks” under “Tools & Settings” (select root user) with a command that could look like this:

nice -20 rsync -avz --stats --delete /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps 2>&1 | mail -s "backups dir rsync report" you@youremail

Databases

I will refer to MySQL databases in this section.

Database content is important, and you must back them up regularly, be it incrementally or not. I have Perl scripts that are in charge of dumping the content of the entire dataset and compress it. The file for my setup ends up being about 300MB, which is acceptable. I proceed to dump the content of the dataset via a “schedule” (root cron) and another cron simply “rsync’s” this file over to the backup server.

Email

All the email accounts are in /var/qmail/mailnames, the process is the same as above, use a rsync via a cron:

rsync -avz /var/lib/qmail/mainames/ user@domain.rsync.net:var/qmail/mailnames

Website content

Same as email but the directory is /var/www/vhosts/ so:

rsync -avz /var/www/vhosts/ user@domain.rsync.net:var/www/vhosts

There you have it, obviously I am providing this entirely as guidance and will in no way be liable for any loss you may get using these instructions. Even if you are on a cloud server (like me) it is a good idea to be able to extract files, especially databases or web content should a mistake be made that a cloud server cannot prevent like deleting a site by mistake etc…

Feel free to comment if you have any questions or if I have missed some important bits to backups that a Plesk backup may make which aren’t in this article.

Thunderbird: There was an error saving the message to Draft. Retry?

There was an error saving the message to Draft Retry? = Crash

A nagging problem has really made me crazy today, so much so that I finally decided to fix it. As usual this problem is probably not common, basically I could not save messages in the draft folder on one of my accounts. I don’t usually use the Draft folder, however Thunderbird does, automatically, try to save messages into draft after a set period. Having a problem saving to draft always led me to lose very long messages for ever (having to restart the whole thing really did it for me!). So  I tried the following:

  1. Compact folder (a popular one for Thunderbird users)
  2. Changed the folder permissions
  3. Deleted the folder and the Draft.msf file
  4. Repaired folder (under folder properties)

None of the above worked.

The fix

So if this happens to you also, this is how I finally fixed it:

  • Closed Thunderbird
  • Created a new folder under the Mail directory
  • Changed the local folder in the account settings > server settings in Thunderbird to point to the newly created above folder.
  • Copied the content of the old folder to the new one (I omitted  the Draft folder  and draft.msf file though, they were empty – remember I could not save into it)

Restarting Thunderbird made the problem go away. Finally!

 

Website layout and content best practice

In view of a recent article regarding the situation of websites rankings on major Search Engines, particularly Google. I think it is time for me to digest most of it and get some sound bites out for reference.

This article will treat both causes and effects relating to SEO and good website content, there are no secret recipes, just plain common sense. Unfortunately, common sense tends to go out of the window when a few simple facts are apparents:

  1. The website is designed using WYSIWYG editors by an non coder
  2. The website is not HTML Compliant
  3. The website is full of typos and makes no sense
  4. The website is lacking good honest real information humanely readable

Let’s not kid ourselves, Search Engines, any search engines, haven’t got the clairvoyance of a human reader, yet the situation is quite comical in a way, as most people scan a web page in a hurry to find the next thing they’re hunting about and you work towards making a website “scan-able” but wait, you have to expect a Search Engine to understand what that web page is about and serve this page to a visitor looking for that specific information whichever it may be.

It is no surprise that people behind search engines are seeing that quality is important, so by using these criteria, a new era of website craftsmanship is [back] upon us; it is time for people that know how to design websites to harness their powers as devised by the creator of the world wide web: Tim Berners-Lee.

Put simply:

Write compliant and correctly spelled web  content which makes sense.

That’s it. Combine this with your niche market and you should be all good (well… not bad).

Know your HTML and the rest

Yes folks, that means you must at least know your HTML from your CSS and JavaScript and be able to write clean code, so that alienates how many % of the Industry? What about those “free website templates” resources and the like… I don’t reckon these will keep on going or will they? Come to think of it, they probably will, but not to worry!

If you knew how much I laugh sometimes when I look at some web pages source code you’d laugh with me. I recently came across an SEO company that had their own website entirely designed in Flash. I kid you not!

Knowing HTML coding [I do all my websites in native code] allows you to also know exactly what the optimal hyper text mark-up language for the page is. Obviously Search Engines like that (why wouldn’t they?).

Untie style from content, have a  separate CSS file and don’t clutter the page with on-page styling. Well you might let the  non-coders do their stuff and then clean afterwards for them, bless.

Know your grammar

Anyone can type text as long as they’ve got the right tools, well unless they’ve got a problem with reading and writing in the first place, the tools usually come with a spell checker, use them, and have someone else read after you. Sometimes staring at your own work hides things for all to see but you.

By having clean HTML surrounded by correctly written content is half the battle, at least you can rest happy that all the badly spelled and written websites can only behind yours in the Search results (Although the purists would tell you that it actually makes sense to exploit the mistakes made by others).

Know what and how to write

This probably is the most important aspect of a website content, years ago it was common practice to emphasise keywords with bold and use a lot of Header title tags including purposefully key-worded links within a tight number of words per page to maximise your ranking. Today I am not sure it is as relevant, Search Engines algorithms should be considering these as spam anyway. So I think that if content quality is more predominant than in the past let’s scrap the rule books and start to write web pages with the “scan” factor of the reader in mind whilst providing the “understanding” factor of the Search Engines algorithms, that alone is a tall order you might say, however people in the know simply know this, period.

To summarise: write clear content that makes sense with heading titles in the right order and meaningful sentences within properly defined tags containing all the required (and non-required) attributes allowed.

The importance of linking

Back links are (still) hugely important. However if these links are placed on irrelevant pages it makes no difference, you might just as well have none. So link build wisely my Friend. Also I think the emphasis on websites that actually link to other reference content (especially when the originating site may look like a reference in itself, right?) will be more pronounced. So don’t be afraid to link to relevant content (or irrelevant if it is required, you can still do that!). Don’t simply accept any links that are to be pasted on your “Links” page any more, in fact I would scrap the links page all together.

Be unique

And that does not just mean write your own stuff but design your own unique site as well (or have someone like me do it), be it HTML 4 transitional or XHTML 1.0 Strict does not matter, using DIVs or TABLEs does not matter. On a side note I would say that web 2 stuff should be avoided for important bits like navigation and so on (unless it degrades gracefully), as long as your code is in good shape but not replicated on 1000’s of other websites (funny that we’re getting back to free websites templates again) you should be all good.

Check and re-check, don’t forget to check again..!

This is the most important bit, HTML, Copy Writing, Spelling, Titles, Keywords, Descriptions, Alt tags, they all matter.

Other aspects worth noting

Apparently the Geo-location of your site is somewhat quite important too, so if your market is for Fish and Chips Take Away for the British market don’t host in the US for example, host in the UK. If you can host in various countries do it you can get hosting for next to nothing, but remember to target the market, mirroring your own site will not do.

Host your site on a fast server. Most people (I am one of them) aren’t going to wait around more than 4 or 5 seconds looking at a white page of a sluggish site, Personally I am gone in less than that, again, Search Engines would probably consider that to be showing signs of bad design and/or lousy hosting service and by doing so reducing the quality of your own business in the process.

If you are providing a service, for God’s sake, PROVIDE all of it, that means being there for your customers, don’t necessarily provide a phone number if you don’t want to be called at 2am in your home business phone line, but reply to your customer in a timely manner, and keep them updated at all times, you’ll be amazed how much good that does to your reputation, and that gives you another edge against your competition, you need it, remember?

Social

Be active on social websites with news and updates regarding your business, you may have the same news replicated on your own site, but keep the site for a formal type of news and loosen up a bit on Facebook or Twitter, it’s almost a full time job (I know! but I am lucky I am not the one doing it. :-)). It might be good to have a Like button on your website, I have developed a JavaScript code that I simply stick into an “include” and the JavaScript does the rest… I don’t have to worry about the link not being seen by S.E. as I think the social website’s got enough incoming already and Search Engines probably disregard that. But don’t stop there, keep your clients, followers and friends in the loop as well to make them remember you.

If you have a mailing list you must use that, however email being so elusive and seen as a spam harbour that, one day, it might not proving to make marketing  sense any-more. So using social networks make perfect sense, but obviously it does not mean that these are mutually exclusives, far from it.

Use the power of youtube, get an HD camera (there are very good and quite cheap ones now) and take the time to make a video promoting your business, it does not need to be fancy, make sure the shots are steady enough (use a tripod) and video editing software, if it is too complicated for you, hire someone, do it as it makes you stand out more than those who haven’t got a video, that also is probably a criteria for Search Engines Optimisation.

How Exciting!

Just added a new Plugin on this Blog to enable me to be more creative. I am still experiencing with it. I am glad to see that one of the biggest issues with CMS systems is still their level of complexity.

The most important barrier to past, modern and future technologies is simplicity and foremost usability and ability to remember how it works. In 2001 that was when I saw a website called Superupdate, now Hannon Hill advertising their CMS, I looked into it, it was relatively simple. So I though, I can easily do that even easier and simpler and created my own CMS system A very simple system, so simple that It is for people that are barely able to use Computers at all. Most of these people being the mature generation,

This is not a problem for things that you’re using all the time like Smart phones (well how much do you actually know about the phone you’re using? Do you know for example it’s got a feature allowing you to make phone calls). It’s more like when you tend to not do it often and you’re not an Internet Guru, let alone a PC wiz kid. For most people having or managing a website is not necessarily something they do on a full time basis. like the chairman of a Club or a charity or a one man business. That is my target market. My website design site provides an unique design plus the ability to edit the pages easily and fast without having to hold a degree in Computing Science. My clients only contact me when they need technical assistance, it works because it is KISS.

WordPress

This CMS system is quite good I must say, (the one that I used to create this content.), it is relatively simple, the strategy is working great especially the Plug-In system, although I must say that I struggle, it’s getting too complicated for me already.

How Exciting?

Now the reason, finally, of my excitement is that when you are using WordPress you tend get a lot of spam messages (well this site does). I am happy to announce that on this front there’s  been a development, with the use of a Plug-in called Spam-stopper which is the easiest one ever. I have yet to receive a single spam comments 🙂 or any comments at all for that matter.

Fruit shopping

As I went to get some fruit from my local Supermarket, I decided to take a look at their Country of origin, the Bananas where from Colombia, the Apples from Brazil the Corn on the  Cob from Portugal and a salad from Morocco.

There were no British Fruit, This is hardly promoting local Producers. It is amazing that despite the transport cost, it still make sense to have most cheap products imported from half way across the World than help the economy by buying and producing British. But ah, there’s a problem, buy British and face a sensible increase in price. Yet the economy is on its knees, no-ones buying local produce and no-one’s getting paid …Once in the hole….

I recently bought very cheap (and very good when Barbecued) Lamb steaks, coming from New Zealand, dear Lord! My regular Bacon is from Denmark thank God(!), not too far off then. I buy British, sorry, Scottish Chicken*, which is less than half what you’d be expected to pay for a similar one in Switzerland (yet the price of milk is about the same).

I decided to get my Free range eggs from a local Neighbour like I used to do a couple of months ago, the eggs are really good and they charge £1.50 for half a dozen. Try you get “as good as” Eggs in a shop at that price since January this year.

But the plans is really to get my own Hens and have my very own Free Range Eggs in the not too distant future.

I think I will start to grow my own, again… We should all do. At least we’d have more money for Fuel. Now how much is recycled plastic sheeting?

*And very good too with Roasted Potatoes (which are also Scottish phew).