Michael Helm's Technology Blog
Linux Servers, Cpanel and Mysql and Raspberry Pi along with my own tech thoughts
    • Home

    Personal Software Projects Portfolio

    Update Your Windows Programs with Ease: Mastering the winget upgrade Command

    Navigating Email Spam Filters: Understanding and Adjusting Sieve Scripts on Plesk Servers

    Expanding the Root Partition on Debian with LVM: A Step-by-Step Guide

    Block WordPress XML-RPC Requests on Linux Servers

    Wi-Fi for Raspberry Pi: Setting Up the Edimax Nano USB Adapter

    January 20, 2016By adminin Blog Tags: Edimax Nano USB, Raspberry Pi, Raspberry Pi networking, Raspberry Pi projects, Wi-Fi setup, wireless adapter, wireless connectivity, wpa_supplicant

    The Raspberry Pi computer comes without Wi-Fi initially, but its true freedom is reached when you connect it wirelessly. There are a number of options for this, but I’d recommend using the Edimax Nano USB adapter. It’s easy to set up your Raspberry Pi to work with this device—just follow this straightforward guide.

    Required Hardware

    First, you need the Wi-Fi dongle (other adapters may work with this guide, as long as they have drivers for the Raspberry Pi). The Edimax Nano USB adapter is available from Amazon UK and other retailers.

    Once you have the dongle, simply plug it directly into one of the Raspberry Pi’s USB ports. I recommend using a direct port rather than connecting via a USB hub, as sometimes problems can occur going through a hub. The Raspberry Pi has enough power to run this compact networking tool without issues.

    Verifying the Adapter Is Detected

    First, let’s check that your Raspberry Pi recognises the adapter. For convenience, I’ll use sudo su to switch to root access (remember to exit this level when you’re finished):

    sudo su

    Now, check the USB devices with:

    lsusb

    You should see your device listed, similar to this:

    Screen-Shot-2016-01-19-at-13.09.19

    The line with “Edimax” shows your device is detected and you’re ready to configure it.

    Checking Current Wi-Fi Status

    If you have configured Wi-Fi before (for another adapter), it may have already connected. Type:

    iwconfig

    If it says “unassociated”, then you need to proceed with configuration. If it’s associated (like the screenshot below), you’re done and don’t need to do anything further:

    Screen-Shot-2016-01-19-at-14.34.27

    The top line ESSID indicates that the Wi-Fi is configured and working. If you cannot see wlan0 or wlan1, then your device is not working yet—try unplugging it or rebooting your Raspberry Pi.

    Configuration Steps: Network Interfaces

    First, we need to make sure the WLAN interface is set up for hot-plugging and establish the filepath for the configuration. Edit the network interfaces file:

    nano /etc/network/interfaces

    Make sure the following lines are present (some are probably already there):

    auto wlan0 allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicate/wpa_supplicant.conf

    If you find a wlan1 entry, you may want to add similar lines for it as well (this sometimes happens if you switch the USB ports). This ensures any wireless interface connects properly (alternatively, you can point to a different configuration file to connect to different networks).

    Screen-Shot-2016-01-19-at-23.51.39

    Configuration Steps: Wi-Fi Security Details

    Now we need to edit the WPA supplicant file and add your network details:

    nano /etc/wpa_supplicate/wpa_supplicant.conf

    If the fields are missing, add them in. Put your SSID and password in quotes as shown:`

    network={ ssid="YOUR SSID HERE" psk="YOUR KEY HERE" proto=RSN key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP }

    Bringing Up the Wi-Fi Interface

    Once you’ve completed the configuration, bring up the interface:

    ifup wlan0

    You may get some errors, but it is usually safe to ignore them. To see if the configuration has worked, run:

    ifconfig wlan0

    You should see an IP address assigned to the interface:

    Troubleshooting

    If you encounter any problems, I’d recommend rebooting your Raspberry Pi. This will start up the wireless interface as the system boots.

    sudo reboot

    After rebooting, check the connection status again with iwconfig to confirm everything is working properly.

    Benefits of Wi-Fi on Your Raspberry Pi

    Adding wireless connectivity to your Raspberry Pi offers numerous advantages:

    1. Flexibility in placement: Position your Pi anywhere within your Wi-Fi range
    2. Reduced cable clutter: No more trailing Ethernet cables
    3. Portable projects: Ideal for mobile applications and projects
    4. Remote access: Easily SSH into your Pi from anywhere on your network
    5. Internet of Things (IoT) applications: Perfect for connected devices and sensors

    Conclusion

    The Edimax Nano USB adapter is an excellent, compact choice for adding Wi-Fi capabilities to your Raspberry Pi. Once properly configured, it provides reliable wireless connectivity that opens up new possibilities for your Raspberry Pi projects.

    With this small and affordable addition, your Raspberry Pi can be transformed from a tethered computer into a fully mobile computing platform, ready to power your next creative endeavour.

    Monitoring Disk Space Usage on Raspberry Pi with ncdu

    January 17, 2016By adminin Blog Tags: command line, disk space, disk usage analysis, ncdu, Raspberry Pi, Raspberry Pi tools, Raspbian, storage management, System Administration

    You’ve had your Raspberry Pi working away, first as a media center, then a web server with a database, and you’ve been tinkering with lots of other features. But now you’re wondering: what exactly is taking up all your storage space?

    Fortunately, when running Raspbian, the Raspberry Pi comes with an excellent command-line tool already installed that makes analyzing disk usage straightforward and intuitive.

    Introducing ncdu: NCurses Disk Usage

    The ncdu tool (NCurses Disk Usage) provides an interactive, visual way to explore your Raspberry Pi’s storage. It’s significantly more user-friendly than the standard du command and allows you to navigate through your directory structure to find space-hogging files and folders.

    Basic Usage

    To start using ncdu, simply open a terminal or SSH into your Raspberry Pi and type:

    ncdu

    This command will scan your current directory and all subdirectories, displaying a sorted list of folders by size.

    If you want to analyze a specific location, you can provide a path:

    ncdu /home/pi

    Scanning Only the Root Filesystem

    One particularly useful option is to only scan the root filesystem without crossing into other mounted devices (like external hard drives or network shares). This gives you a clear picture of what’s taking up space on your SD card:

    ncdu -x /

    The -x flag tells ncdu to stay on one filesystem and not cross filesystem boundaries.

    Reading the Display

    After scanning, ncdu will show you something like this:

    2.6GiB [##########] /usr 1.0GiB [### ] /home 633.8MiB [## ] /opt 593.0MiB [## ] /var 141.4MiB [ ] /lib 10.2MiB [ ] /media 10.1MiB [ ] /mnt 7.9MiB [ ] /bin 7.5MiB [ ] /sbin 6.7MiB [ ] /etc 1.7MiB [ ] /tmp 40.0KiB [ ] /root 16.0KiB [ ] /lost+found 4.0KiB [ ] /srv 0.0 B [ ] /sys 0.0 B [ ] /run 0.0 B [ ] /proc 0.0 B [ ] /dev 0.0 B [ ] /boot

    This visual representation makes it immediately obvious where your space is being used. In this example, the /usr directory is using 2.6GB, while /home is using 1GB.

    Navigating the Interface

    Once ncdu is displaying the results, you can:

    • Use the arrow keys to move up and down the list
    • Press Enter to dive into a directory
    • Press Backspace or Left arrow to go back to the parent directory
    • Press q to quit the program

    This interactive navigation makes it easy to drill down into directories to find exactly what’s consuming your space.

    Advanced Features: Exporting Reports

    If you want to save your disk usage analysis for later reference or comparison, ncdu allows you to export reports:

    ncdu -x -o /home/pi/filesystem.txt /

    This command will scan the root filesystem and save the report to /home/pi/filesystem.txt. Note that this file is in a binary format and isn’t human-readable directly.

    To view an exported report later:

    ncdu -f /home/pi/filesystem.txt

    This feature is particularly useful for:

    • Tracking space usage over time
    • Comparing before/after a cleanup operation
    • Documenting system state before making major changes

    When to Use This Tool

    The ncdu utility is particularly valuable when:

    1. Your Raspberry Pi is running low on space
    2. You’re trying to optimize an SD card with limited capacity
    3. You suspect log files or cache directories might be filling up
    4. You need to identify which applications are consuming the most storage
    5. You’re preparing to back up or clone your system

    Conclusion

    The ncdu tool provides a user-friendly way to analyse disk usage on your Raspberry Pi. Instead of guessing what might be taking up space or running multiple commands to piece together the information, this single utility gives you a clear, interactive view of your storage situation.

    If you’re managing a Raspberry Pi for any length of time, this tool will likely become an essential part of your maintenance routine. Give it a try next time you’re wondering where all your free space has gone!

    Are You Ready for Google’s Mobile Update? The Mobile-Friendly Algorithm Change

    March 12, 2015By adminin Blog Tags: algorithm update, Google, mobile optimization, mobile testing, mobile-friendly, responsive design, search rankings, SEO, website optimization

    Google recently announced on one of their blogs that an update coming in the next couple of months will elevate the relevance of mobile-friendly websites in search results. This change represents a significant shift in how Google ranks websites, particularly for searches performed on mobile devices.

    What This Update Means For Your Website

    This algorithm update (sometimes referred to as “Mobilegeddon” in SEO circles) means that websites optimized for mobile devices will likely see improved rankings in mobile search results, while non-mobile-friendly sites may experience decreased visibility.

    The change reflects the growing importance of mobile browsing, with many industries now seeing more than 50% of their traffic coming from mobile devices. Google is adapting its ranking factors to better serve users who are increasingly using smartphones and tablets to access the web.

    How to Check If Your Site Is Mobile-Friendly

    Google has provided a simple tool to check if your website meets their mobile-friendly criteria:

    Google Mobile-Friendly Test Tool

    Using this tool is straightforward:

    1. Enter your website URL
    2. Wait for the analysis to complete (usually takes less than a minute)
    3. Review the results

    Understanding the Results

    If your website passes the test, Google will confirm that your site is mobile-friendly with a message indicating you’re “awesome!” This positive result suggests your site should maintain or potentially improve its position in mobile search results after the update.

    If your site fails the test, Google will provide specific reasons why, which might include:

    • Text too small to read
    • Links too close together
    • Mobile viewport not set
    • Content wider than screen
    • Use of incompatible plugins (like Flash)

    What to Do If Your Site Isn’t Mobile-Friendly

    If your website doesn’t pass Google’s mobile-friendly test, consider these options:

    1. Implement Responsive Design: This approach allows your website to adapt to different screen sizes and is Google’s recommended solution.
    2. Create a Mobile Version: Develop a separate mobile version of your site (often on an m.yourdomain.com subdomain).
    3. Use a Mobile-Ready Theme: If your site runs on a CMS like WordPress, consider switching to a mobile-optimized theme.
    4. Consult with a Web Developer: Professional assistance may be necessary for more complex websites.

    The Urgency Factor

    Given that Google has publicly announced this update in advance, it’s clear they want webmasters to take action. Historically, pre-announced Google updates have often had significant impacts on search rankings.

    With mobile traffic continuing to grow year over year, ensuring your site is mobile-friendly isn’t just about maintaining search rankings—it’s about providing a better user experience for an increasingly mobile audience.

    Conclusion

    As Google continues to emphasize mobile usability as a ranking factor, having a mobile-friendly website is becoming less of an option and more of a necessity. Taking the time to check your site’s mobile compatibility and making necessary improvements could help you stay ahead of competitors who haven’t yet adapted to the mobile-first web.

    Check your site today using Google’s mobile-friendly test tool, and if necessary, make plans to update your website before the algorithm change takes effect.

    Speeding Up Zen Cart: Optimizing Performance with Image Handler

    August 13, 2012By adminin Blog Tags: bandwidth reduction, ecommerce performance, ecommerce plugins, Image Handler plugin, image optimization, image resizing, page speed, website optimization, Zen Cart

    When optimizing your Zen Cart installation, there’s a particularly powerful plugin that can significantly improve performance: Image Handler. This plugin comes in multiple variants, with Version 4 designed for Zen Cart 1.5.x and Version 3 for the 1.3.x versions (which remain the most commonly used as of this writing).

    What Does Image Handler Do?

    At its core, Image Handler automatically resizes your product images for optimal display. The process works as follows:

    1. When an image is first requested, the plugin creates appropriately sized versions
    2. These optimized images are stored in a cache directory
    3. On subsequent page loads, the system serves these pre-optimized images instead of processing the originals again

    The Performance Benefits

    The advantages of implementing Image Handler are substantial and measurable:

    Reduced File Sizes

    In my testing, a sample original product image of 14KB was reduced to just 5.7KB in its optimized form—a nearly 60% reduction in file size. When you multiply this across dozens of product images on category pages, the savings become significant.

    Faster Page Load Times

    Based on a recent implementation, I’ve observed:

    • At least a 50% reduction in load times on the main store page
    • Even greater improvements on category and search results pages where 12+ images might load simultaneously
    • Slightly increased load times on the first day (as images are initially processed), followed by dramatically improved performance from day two onward

    Reduced Bandwidth Consumption

    The store I worked on experienced approximately a 25% reduction in overall bandwidth usage after implementing Image Handler. This occurred despite an increase in visitor engagement (meaning more pages were being viewed).

    Minimal CPU Impact

    While there is some processing required to generate the optimized images, this happens only once per image. The CPU usage during image generation is minimal, with each image taking less than a second to process.

    Preserving Image Quality

    It’s important to note that your full-size images remain available when needed. The system only serves the smaller, optimized versions for thumbnail and category views. When a customer clicks to view a larger image, they’ll still see the full-resolution version.

    Additional Features: Hover Zoom

    Another valuable feature included with Image Handler is the hover zoom functionality. When customers hover their cursor over a product image, they can see a zoomed-in view without navigating to a new page. This is particularly useful for:

    • Jewelry and accessories
    • Products with intricate details
    • Items where texture or material quality is important
    • Any product where customers benefit from seeing close-up details

    Real-World Example

    To see Image Handler in action, visit Delicate Dreams (Sterling Silver Jewellery). I recommend examining the image attributes and file sizes to understand how the optimization works in practice. Notice how quickly the product images load while still maintaining excellent visual quality.

    Implementation Considerations

    While Image Handler is relatively straightforward to install, there are a few considerations:

    1. Cache Directory: Ensure your cache directory has appropriate permissions
    2. Initial Processing: Be aware that the first few days after implementation may see slightly higher server resource usage as images are processed
    3. Version Compatibility: Make sure you select the correct version for your Zen Cart installation

    Conclusion

    If you’re looking for a straightforward way to improve your Zen Cart store’s performance, Image Handler should be high on your list of optimizations to implement. The combination of faster page loads, reduced bandwidth usage, and enhanced user experience through features like hover zoom makes this plugin an excellent investment of your development time.

    Auto Draft

    April 11, 2012By adminin Blog Tags: future of mobile, iPad optimization, mobile browsing, mobile design, mobile payments, responsive web design, site redesign, user experience, web design trends

    Regular visitors to this blog (which posts less regularly than you deserve) will have noticed I change designs regularly. Normally I choose a design that intrigues me or that might allow me to experiment with something new. However, this doesn’t always help you, the real “customer” of this blog.

    A New Direction for the Blog Design

    After reviewing the visitor statistics, I’ve settled on this as the new look, and I don’t plan on changing it for a while. The main advantage of this new design is its suitability for both traditional browsers and mobile devices like smartphones. It looks good on a normal browser and a mobile-sized screen, with easily identifiable areas for the now-common double-tap-to-zoom gesture.

    Why Not Use a “Mobile-First” Theme?

    You might wonder why I haven’t opted for a truly mobile-optimized theme—the kind that transforms a site into simple rectangles that expand as you interact (like Wikipedia on your phone). The answer is simple: I hate them.

    Part of the point of a website is to show people content creatively. The standard approach to making sites suitable for smartphones seems to be stripping away everything distinctive and interesting. With today’s relatively generous bandwidth limits and 4G networks on the horizon, I believe the internet should be used as originally intended—as a medium for rich, engaging experiences.

    The Exception: Online Payments

    There is one exception to my anti-minimalist stance—online payments. They’re a nightmare on a normal site and extremely painful on a mobile device. If we want people to interact outside of app stores, we really need to improve this aspect of the mobile web. So far, Amazon seems to be the only online retailer where repeated purchases are genuinely convenient on mobile devices.

    Fortunately for me, I don’t need to take payments—unless you think I deserve compensation for this sporadic essay writing!

    The iPad Paradox

    After a couple of weeks of using an iPad, I’ve noticed another issue: many mobile sites serve a dumbed-down, washed-out experience to iPad users. This makes little sense because the iPad is not a phone—it actually has better screen resolution than many laptops and even some high-end desktop monitors.

    This means iPad users should ideally see your site as originally intended, not a stripped-down mobile version. The only website elements that really don’t work well on iPads are sliders, and even they can be made functional with some adjustments. In many ways, the iPad represents where mobile devices are heading, not where they currently are.

    The Future of Mobile Screens

    I believe small screens are only a temporary phase in technology evolution. Five years ago, no one really thought we’d move beyond the maximum 320×240 pixel screens that were standard at the time. Yet here we are with smartphones featuring resolutions that rival laptops.

    With projects like Google’s Augmented Reality glasses potentially becoming available to consumers, screen real estate will expand to these new form factors. Flexible displays are also getting closer to mainstream adoption, which will allow users to physically expand displays beyond their default sizes.

    Already, you can send your smartphone screen to a TV or other devices—this functionality may become the default way of viewing content, with the smaller screen used only when truly mobile (which is not when most phones are currently used).

    Conclusion

    While mobile optimization is important, I believe we shouldn’t sacrifice creativity and engaging design just to accommodate the smallest screens. As technology evolves, our approach to mobile design should balance usability with the rich experience that makes the web unique.

    That’s my opinion made public—read it and ignore at your peril!

    Rush Hour Traffic Made Easy with Waze: A Real-World Experience

    March 10, 2012By adminin Blog Tags: commuting tips, crowd-sourced data, GPS navigation, iPhone apps, Manchester traffic, navigation apps, rush hour traffic, time-saving apps, traffic apps, Waze

    Yesterday I found myself in Manchester after a business meeting. The meeting ended on time (good for a Friday!), but there was still the problem of getting home.

    The Challenge: Manchester Rush Hour

    I know Manchester and have no problems navigating the one-way streets to head in the right direction. My problem is with the traffic. In Manchester, traffic can suddenly grind to a halt, and it feels like driving through treacle—no matter how you twist and turn, you just hit more congestion.

    Along with traffic comes doubt, especially when you’re under time pressure. In my case, I needed to:

    1. Pick up my daughter from nursery
    2. Get home
    3. Get her ready for swimming
    4. Leave for the pool

    All of this needed to happen within an hour of my meeting ending—a daunting prospect during Friday rush hour in a major city.

    The Solution: Waze

    Enter Waze, a nifty little GPS app for the iPhone. While its turn-by-turn directions aren’t always perfect (though they’re continuously improving), Waze excels in one critical area: avoiding or informing you of delays.

    What makes Waze special is its crowd-sourcing approach. Simply by using the app, you automatically send data about the roads you travel on back to the service. This collective intelligence creates a real-time traffic map that’s far more accurate than traditional traffic reporting systems.

    IMG_2348

    Real Results

    The app has been around for a while and has built up a substantial user base, resulting in extremely reliable traffic data. In my situation, I was facing a potential 25-minute delay—time I simply didn’t have to spare.

    Within seconds of identifying the problem, Waze rerouted me through roads that other users (visible as icons on the map where they’ve recently traveled) had confirmed were clear. The end result? I encountered only 5 minutes of delays instead of 25!

    This wasn’t just a time-saver—it was a genuine stress-reducer. Instead of sitting in traffic worrying about being late, I was able to make all my commitments comfortably, transforming what could have been a rushed, stressful evening into a smooth, manageable one.

    IMG_2349

    Why Waze Stands Out

    Unlike traditional GPS systems that might know about major accidents or construction, Waze captures real-world traffic conditions as they happen. The app can detect when vehicles slow down unexpectedly and uses that data to guide other drivers around problem areas.

    Other helpful features include:

    • Alerts about police, accidents, and hazards reported by other drivers
    • Integration with gas price information
    • The ability to coordinate arrival times with friends
    • A gamification element that makes contributing to the community fun

    Final Verdict

    This is an app I cannot recommend highly enough for people who regularly travel during peak times. While no navigation system is perfect, Waze’s crowd-sourced approach to traffic management gives it a significant edge over traditional GPS systems when it comes to navigating congested urban areas.

    Next time you’re facing a time-critical journey through rush hour traffic, give Waze a try—those extra minutes saved might just make the difference between a stressful evening and a relaxed one.

    Password Protecting a Directory with .htaccess in WordPress: Solving the 404 Error Problem

    September 29, 2011By adminin Blog Tags: 404 error, directory security, htaccess, htaccess authentication, password protection, protected directory, website security, WordPress, WordPress configuration

    I’ve encountered this frustrating issue numerous times over the years. Each time I hope “this will be fixed in the next version,” but unfortunately, it persists. Let me explain the problem and share the solution I’ve found.

    The Problem

    You have a directory that you want to password protect – let’s call it “secrets.” It resides in /home/mysite/public_html/secrets/ on your server. You’re using a hosting control panel like cPanel, and you’ve successfully password-protected directories before.

    Before activating protection, you can view the contents of the directory without issues. However, after enabling password protection (which creates a .htaccess file in that directory), instead of being prompted for your username and password, you get:

    • A 404 error, or
    • A 403 message from WordPress saying “Sorry the page you are looking for cannot be found”

    Investigating the Logs

    As a diligent administrator, you might check the server logs and find something perplexing:

    • The access log shows a 404 error (page not found)
    • The error log tells a different story:
    Permission denied: /home/mysite/public_html/secret/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

    Past (Non-Recommended) Solutions

    This error has had various proposed solutions over the years, including the infamous “reinstall FrontPage extensions.” However, these extensions are no longer supported and installing them is strongly discouraged – it will likely cause more problems than it solves!

    The Actual Solution

    The solution is surprisingly simple – just add a couple of lines to the WordPress .htaccess file in the root of your site (e.g., /home/mysite/public_html/.htaccess).

    Find the file and locate the line that says #BEGIN WordPress. Just before this line, add the following:

    ErrorDocument 401 /%{REQUEST_URI}/errors.html ErrorDocument 403 /%{REQUEST_URI}/errors.html

    Why This Works

    The root of the problem lies in WordPress’s permalink structure. When you have “pretty URLs” enabled (which most WordPress sites do), here’s what happens:

    1. You request your password-protected directory
    2. The server tries to access it and encounters the .htaccess protection
    3. The protection mechanism attempts to redirect to an authentication prompt
    4. WordPress intercepts this redirect, treating it as a request for a non-existent page
    5. WordPress then returns its standard 404 error

    Under normal circumstances, WordPress allows direct access to existing files and directories. However, when a directory is password-protected with .htaccess, WordPress doesn’t recognize the authentication request properly.

    The added ErrorDocument directives essentially tell WordPress to stay out of the way when these specific authorization-related error codes (401 and 403) are triggered. This allows the .htaccess authentication process to proceed correctly and display the password prompt as intended.

    Implementation Tips

    • Make sure you add these lines before the WordPress section in the .htaccess file
    • The errors.html file doesn’t actually need to exist – this is just a way to pass control back to the server’s authentication system
    • After making this change, you should get the expected username/password prompt when accessing your protected directory

    I hope this solution saves you time and frustration if you encounter this common WordPress and .htaccess conflict.

    How to Enable mod_deflate for All Sites (Entire Server) in cPanel/WHM

    February 28, 2011By adminin Blog Tags: Apache, cPanel, mod_deflate, page speed, server administration, server performance, website compression, website optimization, WHM

    Mod_deflate is essential nowadays for websites – it speeds up the transfer of HTML pages and other files (such as stylesheets) by compressing them first. With today’s powerful servers, there is very little reason not to use this functionality, especially since many “speed up” tests will not pass without it being enabled.

    While you can enable mod_deflate site-by-site, for shared hosts with many websites this approach is inefficient. Fortunately, you can enable it globally for all sites on your server.

    Step-by-Step Implementation

    1. Ensure mod_deflate is Installed

    First, make sure the module is installed on your server:

    • Use EasyApache and verify that mod_deflate is selected (it may already be)
    • Once Apache has been compiled, deflate functionality will be enabled

    2. Site-by-Site Option

    If you want to enable the functionality site-by-site:

    • In each site’s control panel, a new option is now available
    • Under Software/Services, users can choose to optimize their website
    • This essentially allows deflate to be turned on and off per site

    3. Global Implementation (Recommended)

    To enable mod_deflate for all websites on your server:

    1. In WHM, navigate to: Services Configuration → Apache Configuration → Include Editor → Post Virtual Include
    2. Select All Versions (there’s no reason not to apply it to all Apache versions)
    3. Paste the following code into the file and click Update:
    <IfModule mod_deflate.c>
    SetOutputFilter DEFLATE
    <IfModule mod_setenvif.c>
    # Don't compress images as it's generally pointless
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    </IfModule>
    <IfModule mod_headers.c>
    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
    </IfModule>
    #maximum compression - why not, we have spare CPU
    DeflateCompressionLevel 9
    </IfModule>

    Benefits of Global mod_deflate Implementation

    Enabling mod_deflate across your entire server provides several advantages:

    1. Reduced Bandwidth Usage: Compressed files are significantly smaller, reducing overall bandwidth consumption
    2. Faster Page Loading: Smaller file sizes mean quicker transfers and faster loading times for visitors
    3. Improved User Experience: Faster websites mean happier users and higher engagement
    4. Better SEO Performance: Page speed is a ranking factor for search engines
    5. Consistent Configuration: No need to remember to enable it for each new site
    6. Minimal Server Impact: Modern CPUs can handle the compression with negligible performance impact

    Technical Details

    The configuration above sets the compression level to 9 (maximum), which provides the highest level of compression. While this requires slightly more CPU resources, modern servers generally have plenty of processing power to spare, making the trade-off worthwhile.

    The configuration also excludes image files (GIF, JPEG, PNG) from compression since these formats are already compressed, and attempting to compress them further would waste CPU resources with little to no benefit.

    The “Vary” header is included to ensure proper handling by proxies and caches, preventing them from serving compressed content to clients that can’t handle it.

    By implementing this server-wide setting, you’ll ensure all websites hosted on your server benefit from compression without requiring individual configuration.

    Copying Files Between Linux Servers – Using SCP

    February 26, 2011By adminin Blog Tags: file transfer, Linux, Linux commands, SCP, secure copy, server administration, server security, SSH, System Administration

    For a few years now I keep catching myself transferring files between Linux servers in a silly way…

    What I mean is using something like FTP, or copying to my desktop and then up to the other server – all hassle (and in the case of FTP – inherently insecure). Why do I do this? Well not because there’s no alternative, but because I can never easily remember how to do it the “proper” way.

    The Proper Way: SCP

    So how to do it – simply use SCP. This copies a file using SSH and so is more secure (we trust SSH right?), even better I’ve never had a server which doesn’t support it out of the box.

    Basic File Transfer

    Right so how to transfer one file:

    scp /sourcedir/filename.extension user@serverip:/destinationdir/

    It’s quite simple really – if you run SSH on an abnormal port (you really should it cuts down the attacks) then you can specify the port like this:

    scp -P 2100 /sourcedir/filename.extension user@serverip:/destinationdir/

    Transferring Multiple Files

    Also, if you want to transfer multiple files (e.g. all the images in a directory) then you can just use wildcards – like below:

    scp -P 2100 /sourcedir/*.extension user@serverip:/destinationdir/

    Additional Useful Options

    Here are some other helpful SCP options that can make file transfers even more efficient:

    • -r: Recursively copy entire directories
      scp -r /sourcedir/ user@serverip:/destinationdir/
    • -C: Enable compression during the transfer
      scp -C /sourcedir/largefiles.tar user@serverip:/destinationdir/
    • -v: Verbose mode to see detailed transfer information
      scp -v /sourcedir/filename.extension user@serverip:/destinationdir/
    • -q: Quiet mode to suppress progress meter and warning messages

    Why SCP is Better

    Using SCP provides several advantages over FTP or manual transfers:

    1. Security: All transfers are encrypted through SSH
    2. Simplicity: No need to install additional software
    3. Efficiency: Direct server-to-server transfers save bandwidth and time
    4. Authentication: Uses your existing SSH keys/credentials

    So next time you need to move files between Linux servers, skip the FTP client and use SCP directly. Your data will be more secure, and you’ll save valuable time.

    How to Put WordPress into Maintenance Mode

    February 17, 2011By adminin Blog Tags: maintenance mode, site management, WordPress, WordPress administration, WordPress tips, WordPress troubleshooting

    Sometimes you might need to put WordPress into maintenance mode – this replaces your site with a basic message saying that the site is temporarily unavailable.

    Why Use Maintenance Mode?

    You might want to activate maintenance mode in situations such as:

    • To correct a mistake in a template (so put it in maintenance while you restore from your ever handy backup)
    • While doing manual updating (for instance the automatic updating failed or a plugin is not available for automatic updating)

    Simple Method to Enable Maintenance Mode

    In order to do this, simply put a file in the root of your WordPress install and name it .maintenance. The file MUST be preceded by the “.” similar to a .htaccess file.

    Normally this file has code in it to indicate how long the site will be under maintenance, and if the timestamp passes then the file is de-activated and the site is available.

    For instance, to make the site be unavailable until a specific time (Feb 17th 22:28 2011 in this example) use:

    <?php $upgrading = 1297981662; ?>

    However, if you want the site to stay in maintenance mode as long as needed, then the timestamp just needs to be kept changing. The following code will do the job:

    <?php $upgrading = time(); ?>

    And that’s it – you can put WordPress into maintenance mode without a lot of hassle.

    Removing Maintenance Mode

    To take your site out of maintenance mode, simply delete the .maintenance file from your WordPress root directory.

    ‹ 1 2 3 4›»

    Personal Software Projects Portfolio

    Update Your Windows Programs with Ease: Mastering the winget upgrade Command

    Navigating Email Spam Filters: Understanding and Adjusting Sieve Scripts on Plesk Servers

    Expanding the Root Partition on Debian with LVM: A Step-by-Step Guide

    Block WordPress XML-RPC Requests on Linux Servers

    Michael Helm's Technology Blog
    Copyright Michael Helm 2025.
    The earliest version of this site available is from October 2003 - possibly viewable here: https://web.archive.org/web/20031228013629/http://www.ihelm.org.uk:80/

    ↑ Back to top