Default servers in nginx

Internet

Apache served me well from my teens till lighttpd, then in the last year I’ve moved all my own stuff to nginx. If you come from the perspective of someone learning to configure a webserver from scratch (without preconceived notions of how they should be configured from Apache), its rather lovely to configure and use.

The cloud instance that runs this site also serves several others, so I have a series of virtual hosts, to borrow a term from Apache. Each domain has its own configuration within sites-available, then the servers I want active are symlinked into sites-enabled.

For example:

ls -l /etc/nginx/sites-enabled
    
=> rubenerd -> /etc/nginx/sites-available/rubenerd
=> tigerintherain -> /etc/nginx/sites-available/tigerintherain

If this server receives an http request without a header, or I’ve pointed a domain with my DNS server to it that doesn’t have a corresponding config, nginx will return the first defined server block. In this case, rubenerd. But what if we want to return tigerintherain?

The first approach would be familar to those configuring GRUB: simply prepend 00 to the first virtual host file. I’ve tested this, and it works. It’s also a terrible hack, and it made me feel bad.

The alternative is to append “default_server” to the listening port of the server you want nginx to default to. For example:

server {
    listen 80 default_server;
    server_name tigerintherain.com;
    [..]
}

I prefer this approach because it’s self documenting. The nginx docs point out you can use an invalid character and it’ll still work:

server {
    listen 80 default_server;
    server_name _;  ## resolves tigerintherain.com
    [..]
}

Now you can reboot nginx, and be on your way.


When script kiddies don’t get absolute URLs

Internet

Some Java script kiddie has been having fun trying to download my site. Problem is, he or she doesn’t realise my bookmark links aren’t relative:

86.[redacted] - - [04/Jun/2014:14:57:03 +1000] "GET /https://centos.org HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:04 +1000] "GET /https://debian.org HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:04 +1000] "GET /https://freebsd.org HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:05 +1000] "GET /https://medibank.com HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:06 +1000] "GET /https://slashdot.org HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:06 +1000] "GET /https://soylentnews.org HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:07 +1000] "GET /https://www.libreoffice.org HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:07 +1000] "GET /https://facebook.com/ruben.schade HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:08 +1000] "GET /https://tomcat.apache.org/tomcat-6.0-doc HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:09 +1000] "GET /https://tomcat.apache.org/tomcat-8.0-doc HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:09 +1000] "GET /https://twitter.com/Rubenerd HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:10 +1000] "GET /https://alpha.app.net/Rubens HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:11 +1000] "GET /https://alpha.app.net/kiri HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:11 +1000] "GET /https://developer.apple.com/membercenter HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:12 +1000] "GET /https://facebook.com/kirishimaayama HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:12 +1000] "GET /https://friendfeed.com/rubenerd HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:13 +1000] "GET /https://github.com/orionvm HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:14 +1000] "GET /https://smilesoftware.com/TextExpander HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:14 +1000] "GET /https://twitter.com/MisterSnrub HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:15 +1000] "GET /https://twitter.com/RainerSays HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:15 +1000] "GET /https://twitter.com/RubenSchade HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:16 +1000] "GET /https://twitter.com/Rubenerd_Blog HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:17 +1000] "GET /https://twitter.com/TaleOfAlanADale HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:17 +1000] "GET /https://twitter.com/elkeee HTTP/1.1" 404 162 "-" "Java/1.7.0_45"
86.[redacted] - - [04/Jun/2014:14:57:18 +1000] "GET /https://twitter.com/hanezawakirika HTTP/1.1" 404 162 "-" "Java/1.7.0_45

I have a bog pit/honeypot cloud instance that I redirect obvious spam and attacks to. In this case though, I’m almost willing to make an exception, if only for the entertainment value of knowing someone out there just got a whole lot of empty 404 files in their Java application.


This may need an RTA call

Thoughts

So I finally got my new photo card yesterday from the RTA, or RMS, or whatever they’re calling themselves thesedays. Email from earlier today:

Dear Customer,

You have recently provided your details to sign-up to Online Services.

To get started, go to www.rms.nsw.gov.au/onlineservices and log in using the details below.

Once logged in, you’ll be asked to create a new password and update all your account details.

Clicking the link took me to the generic homepage for the NSW Road and Maritime Services. Logging in with these provided details:

The details you’ve entered are not consistent with our records. Please check your details and try again.

For my American readers, this is my state government’s equivalent to your DMV. Sounds like we haven’t figured out things much better than you all have.


John C. Dvorak on not fixing the obvious

Software

I've been reading John C. Dvorak's Inside Track and other columns since I was old enough to. He's entertainingly opinionated, self deprecating and very often wrong. It's why we love him.

His latest article was an absolute corker. Some choice parts:

There is a belief within the tech community that Microsoft lost control of Windows years ago as the company turned over personnel—including the programmers who actually knew the base code of Windows itself. It has long since become what people call spaghetti code—a tangle impossible to unravel.

As much as I grew up being bitten by Microsoft bugs, this is not unique.

Every patch has to be run through a regimen of tests to see if anything breaks. One thing is fixed and soon something else does not work right.

Ditto. Regression testing is an entire industry.

I have one machine running Vista—which I have come to appreciate as an excellent highly backward-compatible OS.

I'm assuming the lack of comma meant "excellent" described backward-compatiblity. Say what you will about Vista, but I'll bet it runs ancient Windows stuff better than, say, FreeBSD.

None of this is helped by the boneheads in marketing who demand the coders do things they shouldn't.

Metro in a nutshell.

On websites, this includes running videos down at the bottom of the page utilizing delayed auto-start. You have a browser running with a bunch of tabs and suddenly the speakers blare as a video starts. There is no way of finding this rogue video without examining the entire page of each tab and often you still cannot find the blaring video (unless you're on Chrome).

Or using NoScript, or just don't use Flash.

(Every time this happens I'm reminded of the promises of HTML5 to rid the world of Flash. It has failed to do anything of the sort.)

Well, other than the fact it has. Apple and Android killed it with mobile, by not bunding it, or including such a terrible implementation that even Adobe dropped it. But it was open, remember? Oh Google, don't ever change.

Unfortunately, HTML5 hasn't rid us of digital restrictions management (DRM), which is a legitimate concern.

Is a drop-down menu really a better idea than showing all the options without having to roll over something?

It does come down to balance, but with the new hotness being that meatstack icon, it is being abused. Don't worry though, it'll go the way of Georgia or Helvetica Neue Ultralight body text soon enough.

I invite readers to add their observations to the comments with weird anomalies that bug them.

I'll finish off with one. Whenever I deal with Windows machines, I always have to relearn the Control Panel with new releases. The simple visual and naming consistency they achined with Windows 95 has long since given way to a mish mash of constantly renamed, redesigned stuff. Please stop doing this.


UTS Building 11 feedback

Hardware

My rather impassioned post about UTS Building 11 garnered a few responses online and offline. Thanks everyone for the feedback.

The consensus was largely that the building was less than ideal, though expressed with slightly less frustration than my post was. @hanezawakirika appeared visibly shaken by the discussion, and @Asasifs sought to remind me that universities are money making enterprises, and that the true "target audience" of the building wasn't students. Touché!

From some of my lovely Twitterlings:

@wanopanog: all the levels are nearly identical, not 'mismatched'. What bugs me is the fact one can't take the stairs all the way up.

Exactly. If you can't access the floors in the same way, they don't have the same layout and fail for accessibility. And don't get me started on the entirely different basement levels, or that awkward entresol off the foyer, or the awkwardly sized open areas with tables in entirely different places for each floor.

@Dorry_kun: What about a university building, to replace and an older one the students couldn't fit in, being even smaller?

No kidding.

@Dorry_kun: To the point that half the class is sitting out in the hallway listening through an opened door?

I've noticed that in the one tutorial I have in that building as well; there are at least two people who have to steal chairs from other rooms and crowd around computer desks desgined for one.

This may be a symptom of class sizes still being calculated for building 10 rooms. If so, I'm willing to give them the benefit of the doubt while this is all new. If this persists though, the building has failed in the second way a building can.

The foyer and odd basements are probably writeoffs, but I wonder if the odd staircase pattern is structural, or whether they could rip them all out and fix them? Interesting.


The lost opportunity of UTS Building 11

Hardware

What is the point of a building? Without getting normative, its probably safe to say buildings are designed for those who will use it. New office buildings have large, column free spaces; art galleries are in many cases works of art themselves. How people will occupy and use buildings should inform everything about them.

The University of Technology, Sydney, my beloved alma mater, has been spending our student fees on a new set of buildings to inspire their next generation of students and staff. The appropriately binary building 11 was recently opened for the faculty of IT. Given how (relatively) well they renovated the former Fairfax building into Building 10, I had high hopes.

(Aside: I only learned what “alma mater” was after editing Wikipedia infoboxes. Also, what the difference between American fraternities and sororities are. Alpha cappa sandwich. Weird stuff).

UTS Building 11's interlocking binary steel plates, glowing lights and sharp angles sure present an imposing sight from the street. We're a technology university, take a look at our unapologetically modern new structure! It's a sight to behold, especially at night.

Unfortunately, in the architect's quest to leave an impression, its resulting internal design renders it utterly useless in its primary function as a university building. Namely, making it as easy as possible for students and staff to find the classrooms they're paying to attend, or being paid to teach in.

With escalators and stairs of differing lengths interlocking and sending wary, confused travellers different directions with each artistically mismatched floor, its neigh impossible to find anything. Staring up from the ground floor, the initial feeling of quirky fun gives way to the impression of cluttered, unorganised chaos.

There are still classrooms in the basement, harking back to those dark dungeon classrooms of the tower building. The sloping, bare concrete foyer is sterile, cold and slippery with even the lightest rain on one's feet; ditto the brown linoleum stairs that already look filthy.

In its quest to leave students inspired, our student fees have bought a building that fails in the primary way a university building can. I wouldn't call it a white elephant, but I can already hear the collective anguish and frustration of the thousands of students who will be subjected to this building's design for decades to come.


Robin Williams

Thoughts

Robin was one of those previous few who made us laugh and think, as children and adults.

I can't think how to put this unselfishly, but his breathless standup got me through so many of my own dark times. I don't care for celebrities or gossip, but Robin was one of the few I'd have loved to meet. What a wonderful human being.

Peace ♥


You’re subscribed to our new mailing list!

Internet

For reasons I can't penny fathom, the new black is taking the email addresses of all your customers, and subscribing them to your newfangled email newsletters they neither wanted, nor ever requested.

Take this one from Wikia, sent earlier last month:

Welcome to Wikia's debut newsletter from The Social Universe for Fans, by Fans.

Every month, we're going to promote and feature your fan chronicles, offering you a quick resource for everything that's happening in fandom, from movies, TV, games, comics, lifestyle, books and music.

Or this vague one from MechKB:

You are receiving this e-mail because you have previously subscribed to the MechKB newsletter mailing list and/or you have previously purchased from us. Starting from today we aim to send out an e-mail like this once a week / fortnight with various updates and interesting tid-bits about Mechanical Keyboards and, of course, the latest updates and offers from MechKB.com.

Of course, such newsletters are quick to reassure us that we can unsubscribe. This one from Wikia, emphasis not added by me:

If you're not interested in receiving this fandom-filled newsletter each month, you can change your email preferences at the bottom of this email.

And MechKB (it's just so easy!):

If you do not wish to receive these e-mails, unsubscribing is easy. Simply scroll down to the bottom of this e-mail and click "unsubscribe from this list." You can do this in future at any time. Otherwise, scroll down to have a look at what we have in mind.

I don't mean to pick unfairly on just these two companies, everyone from PayPal to my bank is doing it. I also happen to really like their sites, and am using a keyboard purchased from MechKB. The irony isn't lost on me that this newsletter email rant has also given them free publicity.

That said, if I were on the fence or indifferent about a service or site, these opt-out email newsletters may be enough to push me over the edge and take my business or data-minable social activities elsewhere.

Whoever is advising companies to abuse their email lists like this, please stop for the good of humanity and all that we hold dear.


Two years with a MacBook Air

Hardware

I’ve noticed the trend to write reviews of devices you’ve used for a short period of time, during which you’ve just bought it and are excited to discuss it. Here’s some real world usage of an 11″ MacBook Air, two years after getting it.

This MacBook Air is my primary production machine. I use a ThinkPad as a glorified desktop at work, but this Air is everything else; including much of the work I should be using the ThinkPad for. I’ve delegated some tasks to other machines (such as file storage and Xen), but this is what I use plugged into my buckling spring keyboard, trackball and 1920×1200 screen.

As an aside, whoever thought 1920×1080 was a great idea for desktop monitors for the sake of a never proven cost saving in production, and those who defend the decision, need to be bundled up to serve their time in an isolated shack in the woods somewhere, for the good of Humanity.

This Air doesn’t have a Retina display, which sometimes makes me longingly stare at those people’s machines that do. The cursor and function keys are microscopic, a cruel irony for a Vim user. The hinge has always been a little too loose. The internal screen is glossy, and low resolution.

And yet, its lightweight, fast and has been able to handle almost anything I’ve thrown at it. I can have it with me all the time without breaking my back. The action of the keyboard is light and tactile. The fact I haven’t seen that reserve power window before speaks to its portability and continued battery life despite two years of heavy use.

With the impending rumours of a 12″ Retina enabled Air, I’m perfectly happy with this machine.


SCSI

Hardware

Remember SCSI? After a ten year absence in anything I’ve ever used, I handled some Serial attached SCSI cables and devices last week, which prompted some nostalgic thoughts. As you know, I’m a sucker for these.

As many of you no doubt were, I was born slightly too early for USB. On my birth certificate, I’m listed as being strictly a Serial enabled device, something which may explain me being full of ideas, but lacking in the faculties or bandwidth to articulate them on a blog.

But I digress. In the mid 1990s, if you wanted sustained, high[er] speed data transfer your choices were SCSI, or more SCSI. After battling with Parallel port Zip drives and the like, we eventually tried to replace everything with this funny acronym. We had SCSI Iomega drives, SCSI scanners, SCSI espresso machines.

The cables were thicker than tree trunks, and their inverted Parralel port-esque connectors more so. Given they were plug in and forget devices though, that wasn’t really a concern. Where I ran into issues as a kid was understanding that devices all needed to be set with their own unique SCSI ID; many a weekend was wasted trying to figure out why a new device wouldn’t work when that was the only issue! You also had to end the chain with a SCSI terminator, otherwise all the electrons would leak out and cause a mess on the table.

With SCSI cards in our desktops, I was intrigued by their inclusion of a riser port that bore a striking resemblance to an IDE motherboard plug. They were much longer, meaning the IDE cables I’d plug in wouldn’t cover all the pins. Good grief, the things I used to try to do as a kid!

While SCSI has all but disappeared from consumer electronics, its in this capacity the standard is still widely used. Serial attached SCSI cables are just as inflexible, but the standard is comparatively fast and reliable. Well, as fast and reliable as storage devices can be. Their connectors have also long since been rethought, something the skin on my hand noticed when I scraped it on a dozen of the hard metal things.