Mostly about my amusement

Month: April 2008 (page 1 of 1)

Opensuse and apache vhosts

OpenSUSE Logo from OpenSUSE.usThis happens often. I do something on my servers and six months later I try to rebuild from scratch what I did and wish I wrote it down. This is one of those blog posts.

I reviewed my Apache error logs and noticed that WordPress was tossing fatal PHP errors. I was pretty sure it was a particular plugin but I had made so many changes to Apache and PHP5 and I thought it would be easier to remove and re-install Apache and PHP5. So I switched my blog to my backup VPS, updated DNS and took apart my server.

That turned out to be a little painful and more work looking up how to set it up.

Removing the packages was simple. I just ran rpm -qa | egrep “php5|apache” to get the list of packages and created a small shell script to removed them. But I had forgotten how I had setup the virtual servers for more than one website. I wanted to avoid using the old config because I was sure I had made mistakes.

I had setup the main server and that worked. My MRTG and Cricket scripts were displaying correctly. Getting additional virtual hosts turned out to be easy.

In /etc/apache2/vhosts.d directory is a file called vhost.template. I copied that file and called it I edited that copy and change all the to the fully qualified name of my server. In vi thats just :0,%s/ and all the dummy names were changed.

I removed the cgi portion and added some additional Directory, AllowOverride, and Options statements. I set -Indexes and made other changes so that the rewrite rules for WordPress will work.

I saved that file in /etc/apache2/vhosts.d and that permited that my blog virtual server to work. But that caused my existing server to stop working. That was simple to fix. I created a file in /etc/apache2/vhosts.d called The underscore character ensures that this file will be read first; the first virtual server becomes the default.

This file was very short and contained only these lines:

NameVirtualHost *:80
<virtualHost *:80>
DocumentRoot /srv/www/htdocs

This let the web server at /srv/www/htdocs work as if had before I made the virtuals.

I restart Apache and all is well. I did the same thing for my one SSL host in Apache. Unlike clear text http, the SSL based https can’t do multiple SSL sites on one IP address/TCP port. I could run one on 443 and another on a different port, but I don’t bother as I only need one SSL based site.

As long as a DNS entry exists to point that name to your IP address, you can have multiple web sites served from one IP address.

Blog re-theming

How my blog used to lookI’ve been using a modified version of the FastTrack theme by Sadish for a couple of years now. It’s a good theme but it’s designed for a 800×600 resolution screen. Most of the visitors to this website use 1024×768 and on my screen it looked narrow. I felt like I was wasting screen real estate.

So after trying out lots of different WordPress themes, I settled on one called “The Journalist” by Lucian E. Marin.

This new theme has two columns with the main column wide for text. It’s easy to read and I did not change much except add some plugins and a banner at the top.

Adding the image at the top was easy. I took a version of a rotating script that I put together for Stefan’s blog and made it a separate file and where ever I wanted to put the image I just inserted this line into the php file:

<?php include(TEMPLATEPATH . '/rotate.php'); ?>

A copy of the php script can be found here. This one line was inserted into these files 404.php, archive.php, index.php, and single.php. I also create come page templates by copying the index.php and removing the post code inside and replacing it with code for the sitemap, archives page, etc.

In the journalist/images directory I made a new directory called random and placed some 700×175 jpegs there. When the rotate.php is called, it creates a list of images and populates it into a javascript. It’s convoluted but guarantees a random image with every page load.

The images were lifted from Stefan’s Flickr account with permission. If you like one check with him before you use it. I used the Gimp and set the rectangle select tool to a fixed aspect ratio of 700×175. Loading up the highest resolution image available, I was able to cut what I wanted, crop it, and resize it.

In the past I’ve made all my changes to the sidebar in sidebar.php. Widgets are lots easier, so rather than keep beating at the sidebar.php, I just use widgets now and it’s all good.

With this theme I’m using XHTML Transitional 1.0 instead of Strict. It’s easier to work with and more forgiving. I still switch to HTML in the blog editor to fix the image layout by hand and upload the images seperately. With WordPress 2.5.1 TinyMCE adds CSS classes to the img tag so I may just add those tags to my style.css and leave it at that.

Wesley Snipes gets 3 years

Looks like Wesley Snipes is going to jail. Honestly, he should have known better and the civil proceedings have yet to be decided. Wonder how much of an example he’ll be made of in a civil trial?

His two co-defendants didn’t do so well either. One was sentenced to 10 years, the other 4 and half years. What I don’t understand is this: no one likes to pay taxes, period. The idea of not paying taxes for some pseudo legal rational is ridiculous.

There are lots of smart people out there and some of them actually practice law. If it were that easy then everyone would do it.

Either that, or sell books and make money off of the people who buy into this nonsense.

Maybe it’s a mocumentary?

The movie Expelled: No Intelligence Allowed is not getting good reviews. Apparently it’s your basic hatchet job on science.

See this review from the New York Times. With out exception, all the reviews I’ve seen (maybe I’m not reading the “right” web pages) condemn the movie.

Is it possible that this is a joke? Like the movie “This is Spinal Tap”? It’s Ben Stein after all. There is no chance I will go and see this movie in a theater but it sounds like the silly material is set to “Eleven”.

(Was the) Shortest software eval ever

Browser Says NoOver at they talked about the HydraBrowser and how it may go too far with features.

It looks like Internet Explorer with enough add ons to make it “special”. It was special alright; after I ran it it wanted a user ID and password. I canceled that (I just wanted to see the web) and entered a as the URL.

Nothing. No error message, nada.

Control Panel -> Uninstall Software -> Hydra Setup (publisher is listed as Microsoft?) and good bye. Back to Firefox for me. Install to uninstall in less that 10 minutes. I’m sure if it were some other software I’d spend some time with it, but it’s a web browser. How hard should it be?

Update: After the author left some good feedback below, I installed v1.07 on my laptop. It’s not bad and I’m listening to radio via Hydra as I update this. The browser goes for the Office 2007 look and the layout is not bad.

My laptop and PC both have a 16:10 aspect ratio and that permits Hydra to display the web page well and still leave room for the content. The RSS reader looks familiar; I’m a huge Google Reader fan so I probably wont be using that feature. The integration is interesting but the overall experience feels like the product is still developing.

That’s not a bad thing at all. My complaint originally was that without setting up an Admin user, you could not even use the browser. The author’s v1.07 which I’ve just installed, plainly says if you don’t create an account you can still use the guest access. That’s good responsiveness to a “feature request” which was not even in his forum.

I’ll continue to kick the tires some more. I doubt I’ll leave Firefox 2.x anytime soon (Firefox 3 beta 5 annoys me; don’t know why but it does) but I’m glad to see someone is working on another alternative outside of Opera and Firefox.

Internet! You kids get off the lawn!

I have a few blog entries about Gundam episodes and Gunpla and I often put up graphics either of the model I’m assembling or image from the anime I am watching.

This is the Internet and I don’t mind people copying the images onto their website. I mean, why would I? Some of the images aren’t mine, like the Ubuntu logo. if I get an e-mail from Sunrise about a Gundam 00 image, I’d be shocked and flattered.

But I do not like hotlinking and had been blacklisting new URLs on a regular basis. Hotlinking is when some individual on the Internet decides he likes something on my website, so he loads it directly from my server onto his page.

Myspace users do that a lot.

So rather than continue looking at my logs and zapping offenders one at a time, I finally put in the following into my .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*.google..*/ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*.yahoo..*/ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*.msn..*/ [NC]
RewriteRule .*.(gif|jpg|jpeg|png)$ - [F,NC]

This lets search engines that I like get copies of the images (I run a web server on the Internet, I want people to find me). The second line lets the web server load images if there is no referer.

If you try to load an images onto your website from my web server, and you are not on the approved list, then the image will not load. I thought about putting in a “Don’t hotlink you loser” image but why bother? I just want hotlink to my website to stop.

More fun ad placements

CNN has this article about an illegal immigrant who married someone who’s legally in the U.S. but had to go back to Mexico. This seperated the husband from his wife; it’s a sad story and shows some of the real problems that illegal immigrants face.

But what struck me as I read the article was the sidebar advertisement. Ads on websites typically work like this: the advertisement will match up the content. That’s the idea at least.

Here is a picture of the website from my computer.

CNN fun ad

Note the sad picture of the husband crying (nice journalism CNN, you really raised the standard on a serious topic).

Now look at the sidebar ad. I guess the terms “husband”, “wife”, and “love” matched the ad up to the article. At least to another computer.

All is good with WordPress 2.5

WordPress button from WordPress.orgSo far so good. Once I stopped using version 2.3.3 and switched to 2.5 I got the hang of the new admin interface.

The old Admin-SSL plugin stopped working because the cookie code was from the old wp-includes/pluggable.php. The cookies are different so the old plugin failed.

There is a replacement but it does not set the cookies for use with SSL pages only, which was a huge part of the old plugin. I’m going to see if I can get the old one working with the new auth cookie code. My PHP is horrible so I’m not feeling too optimistic.

Mostly WordPress 2.5 worked right out of the box for me. Since I’m using the translation plugin, I get lots of Mysql database timeouts. With 2.3.x I implemented this fix and the translation pages have no issues with database timeouts. The fix has been updated for 2.5 so my database is not complaining anymore.

Thanks to 2.5 I was able to get rid of 2 fix plugins, Optimal Titles and Full Feed. Both are no longer needed. I did modify Bad Behavior slightly and added the Remove Max Width plugin but that’s mostly it.