Stop Apache2 from listening on port 80

I assume you have enabled SSL so the site is accessible via HTTPS.

Assuming you haven’t changed the configuration, go ahead and type

unlink /etc/apache2/sites-enabled/000-default

This would remove the symlink named 000-default, which points to the default vhost found in sites-available. If you have altered the config, make sure to remove any vhost listening on *:80.

This first step is kind of straight-forward. You want Apache2 to stop listening on port 80, you remove any vhost on that port. But that’s not all.

Open up ports.conf

nano /etc/apache2/ports.conf

Comment out (put # at the beginning of the line)

NameVirtualHost *:80
Listen 80

Go ahead and restart the web server and load the changes

service apache2 restart

Now Apache2 should listen on port 443, and 443 only.

Enable HTTPS on Apache2

This would be a quick way to enable HTTPS (SSL) on Apache2.

cd /etc/apache2/sites-enabled
ln -s 001-ssl ../sites-available/default-ssl
nano 001-ssl

Make sure that the vhost configuration is valid. By default it is configured to /var/www. You might want to have some other directory as your document root.

Then run

a2enmod ssl
service apache2 restart

Do leave a comment if you get any errors. Remember to use sudo if you do not have a root shell.

Find Big Files Wasting Your Disk Space With WinDirStat

Storage isn’t that much of a problem anymore, since storage capacity is cheap. But, then again, the files we store are a lot bigger today. And how are you supposed to find what files are hogging your storage space?

For finding a stray file, searching for an asterisk (“*”) and then sorting by size does the trick. No need for fancy software. But sometimes your need a little bit more power.

WinDirStat will, after analyzing your hard drive(s) give you some really useful information. Primarily, you will see a graphical representation of your space, allowing you to find large files in an instant. It will also allow you to see the size of any directory (which is the sum of its content).

You can see how much space every file type allocates. So you’ll be able to notice large amounts of small files as well. Go check WinDirStat out! (http://windirstat.info/)

There’s a Linux variant available as well.

iPhone 4 Dies Before 0% Battery

Some time ago my iPhone 4 died, claiming it was low on battery. Strange, I thought, because it reported 15% just a few minute earlier. So why would my iPhone discharge before the battery is drained?

Turns out the iPhone 4 (or any other model, perhaps) can at times report an incorrect amount of charge. Perhaps you’ve never fully charged the device, or perhaps a bug occurred.

Anyway, how do you fix the battery meter on the iPhone 4?

  1. Restart your iPhone.
  2. Then, you drain the battery. Let the phone discharge on its own, or speed it up by using it (i.e. playing a game).
  3. Let it sit for an hour or two. This is to make sure it’s empty.
  4. Start charging your iPhone, and be sure not to interrupt the charging
  5. Let it sit for an additional hour or two after it’s fully charged. This is to make sure it’s fully charged.

That’s it! Now your iPhone should be recalibrated and report the correct charge.

First time I’ve ever restored a laptop

My Asus laptop worked nicely, but I felt like trying Windows 8 on it. Said, and done. Windows 8 actually makes the laptop seem quicker, but it doesn’t perform as well in games.

I don’t know if it’s Microsoft’s or AMD’s fault, but at times the graphics card wouldn’t engage. The APU (my CPU can do GPU stuff with quite the performance) tries to keep up but obviously can’t keep up. When the card is in use, the crossfire solution gives me the strangest of errors, like black screens in 3D applications.

I’ve tried different drivers. The beta drivers available for download (somehow the non-beta drivers were harder to obtain) didn’t solve the issue, but at least it perform a little bit better. Still nowhere near Windows 7.

And for usability… every time I plugged in a screen via HDMI I had to do a hard reboot. The computer would simply not switch to the internal display again. An ordinary reboot didn’t work either.

So I decided to restore my laptop using those DVD images you get. Burning and restoring took an hour, which I thought was okay since we’re talking about 12GB of data. But of course that wasn’t the entire recovery…

Why ship an image when you can ship a complicated recovery system?

After removing the last DVD from the tray and rebooting, my laptop proceeded to configure itself. On occasion I would see a full Windows shell, with a text overlay of “… DO NOT OPERATE.”. I wonder what would’ve happened if I tried to mess things up at that point.

The amount of restarts needed in order for Asus to configure my system amazes me. And the time! Why did it take a couple of hours? Does it perform a full diagnostic as well? Installing Windows 7 from scratch would be faster.

But I was afraid doing so would leave me in the same graphics-broken state as before.

Aaaaaaand… done! All that remains now is to patch. This feels like the longest part. Slow download. Slow install. No automatic reboot. Slow shutdown. Slow boot. Done! More updates. And again. Done!

If you’re going to restore an Asus laptop, I’d recommend having at least 8 hours. It’s mostly an automated process and can be left unsupervised. The patching requires some clicking.

Time to check what gaming performance I’m getting now :3…

Generic Xbox 360 controller in Windows 7

I bought an Xbox 360 controller a while back, thinking it was an original controller. It wasn’t.

My generic Xbox 360 controller didn’t work in Windows 7 by default, because the system didn’t recognize the controller. At first I thought that I needed the driver, so I headed over to Microsoft’s software download.

The driver software didn’t fix my issue. My Xbox 360 controller still didn’t work.

But, as it turns out, you can manually set the driver if you open Device Manager. That will force Windows to use the proper driver, and the controller will work.

The controller LED stopped blinking. Woo!

Works out of the box in Windows 8, though.

How to Remove the GUI (GNOME) from Debian

I accedently installed the desktop packages for Debian in a virtual machine, when all I wanted was a clean testing box. I’ve had some troubles with the network managers, but mainly – why boot into GNOME when you have no need for a point and click interface? Such a waste.

A quick, and perhaps dirty solution would be to run the following:

sudo apt-get autoremove gdm3

sudo apt-get autoremove –purge gnome*

Works fine in a virtual environment. This is a quick fix I wouldn’t use on an important server. Don’t blame me if something breaks :3.

Windows 8 Automatic Reboot

We all love automatic things, don’t we? Unless they cause inconvenience – then we hate them more than anything else. Do we love automatic updates? Only when they don’t interrupt us!

You probably know what I mean. You boot up Firefox, and leave you waiting while it updates. There are a lot of very good reasons why you should update your software, but would it hurt to wait just a few minutes?

Sometimes we hate Windows update. It’s automatic, it’s good, and it’s the bringer of sneaky reboots. Have you ever been in a full-screen application when Windows informs you about its 10-minute-reboot-deadline? Did you wonder why they couldn’t make it minimize your current program so you actually could see it? I did.

Because why would your operating system force you to reboot? There are a lot of good reasons, really. If you leave your computer on all the time (in an office, for example), this helps a lot. If the system wants to reboot, but no one is available to click the “Ok”-button, it makes sense to let the computer reboot automatically. But why would Windows want to reboot when the user, for example, is playing a game? Is the risk of being hacked so tremendous?

That was Windows 7. What about Windows 8?

Well, apparently, Windows 8 can inform you about a reboot 2 days in advance, but it’s impossible to avert. Windows 8 will make a huge blue warning banner appear on your screen, informing you about the scheduled update-related reboot – and there’s nothing you can do about it.

Who thought this was a good idea? Delaying an important update for two days isn’t a good idea, and forcing a reboot isn’t a good idea. Would two wrongs make a right? Windows 7 did nag me about updating, but it never forced me to stop what I was doing and save my work in four minutes!

I believe the system should notify you immediately when updates are available, and inform you when it wants to reboot. If you’re not there, it can reboot – but if you’re using the system, it will wait. Windows 8 do inform you that your computer will reboot to install updates within a day or two, but it’s easy to forget. And where’s the reminders? Instead of rebooting, you forget, and put your laptop to sleep. Then you will be forced to reboot, when you might have important work to finish.

Meh.