Category: Lightsail Tips

Lightsail is an AWS – (Amazon Web Services) Product for Hosting with a monthly plan and dedicated resources, in this series of posts we focus on sharing tutorials, tips and tricks on using Lightsail as hosting with our Articles, How-To guides and More.

  • cURL Error 28 WordPress with Lightsail? Here’s the Fix!


    Getting cURL Error 28 on WordPress with Lightsail? Here’s How to Fix It!

    If you’re running WordPress on Amazon Lightsail and encountering cURL Error 28, you’re not alone. This frustrating issue often occurs when your server fails to connect to an external resource within the allowed time limit. Whether you’re using Apache or Nginx, resolving cURL Error 28 WordPress issues is straightforward with the right steps. In this guide, we’ll walk you through proven solutions to fix this error and keep your site running smoothly.


    Understanding cURL Error 28

    cURL Error 28 is a connection timeout error that typically happens when your WordPress site tries to communicate with an external API or resource but fails due to time constraints. This issue is common on Amazon Lightsail because of its default server configurations, which may not be optimized for WordPress.


    Common Causes of cURL Error 28

    Several factors can trigger this error on Lightsail:

    1. Server Timeout Settings: The default timeout values may be too short for certain requests.
    2. Resource Limitations: Lightsail instances have limited CPU and memory, which can slow down request processing.
    3. Network Issues: Connectivity problems between your server and external resources can also cause this error.

    Step-by-Step Fixes for cURL Error 28

    Here’s how to resolve cURL Error 28 WordPress on Lightsail, whether you’re using Apache or Nginx:


    1. Adjust PHP Timeout Settings

    Increasing the PHP timeout limit is one of the most effective solutions.

    • For Apache Servers:
    1. Connect to your Lightsail instance via SSH.
    2. Locate your php.ini file (usually in /etc/php/7.x/apache2/).
    3. Increase the max_execution_time value to 300 or higher.
    4. Save the file and restart Apache:
      bash sudo systemctl restart apache2
    • For Nginx Servers:
    1. Follow the same steps to edit the php.ini file.
    2. Increase the max_execution_time value.
    3. Restart PHP-FPM and Nginx:
      bash sudo systemctl restart php7.x-fpm sudo systemctl restart nginx

    For more details, refer to the official PHP documentation.


    2. Optimize Server Resources

    Lightsail instances have limited resources, so optimizing your server can help prevent cURL errors.

    • Upgrade Your Instance: Consider upgrading to a higher-tier plan with more CPU and RAM. Learn more about Lightsail pricing.
    • Use a Caching Plugin: Plugins like WP Rocket or W3 Total Cache can reduce server load.
    • Monitor Performance: Use tools like Amazon CloudWatch to track resource usage.

    For additional optimization tips, check out our guide on How to Optimize WordPress Performance on AWS Lightsail.


    3. Troubleshoot Network Connectivity

    Network issues can also cause cURL Error 28. Here’s how to troubleshoot:

    • Test External Connections: Use the curl command to test connections to external URLs.
    • Update DNS Settings: Ensure your DNS configurations are correct.
    • Disable Problematic Plugins: Some plugins may interfere with connectivity. Disable them one by one to identify the issue.

    For advanced troubleshooting, refer to this guide on cURL errors.


    4. Modify cURL Timeout in WordPress

    You can increase the cURL timeout directly in WordPress by adding the following code to your wp-config.php file:

    php define('CURLOPT_TIMEOUT', 300); define('CURLOPT_CONNECTTIMEOUT', 300);

    This ensures WordPress allows more time for cURL requests to complete.


    Preventing cURL Error 28 in the Future

    To avoid this error, follow these best practices:

    • Keep your WordPress core, themes, and plugins updated.
    • Use a CDN like Cloudflare to reduce server load.
    • Regularly monitor your site’s performance and address issues promptly.

    For more tips, read our article on Top 5 Plugins to Speed Up Your WordPress Site.


    Final Thoughts

    Fixing cURL Error 28 WordPress on Amazon Lightsail is manageable with the right adjustments. By optimizing server settings, upgrading resources, and ensuring proper connectivity, you can resolve this error and maintain a smooth-running website.

    Have you encountered cURL Error 28 on your WordPress site? Share your experience or ask questions in the comments below! Don’t forget to share this guide with others who might find it helpful.

  • Sequel Pro Lightsail Connect WordPress blog Database to your MacOs

    How to Connect Your WordPress Blog Database to Your Mac Using Sequel Pro and Lightsail: A Step-by-Step Guide

    If you’re managing a WordPress blog hosted on Amazon Lightsail and want to access your database directly from your Mac, Sequel Pro is an excellent tool for the job. This step-by-step guide will walk you through the process of connecting your WordPress blog database to your Mac using Sequel Pro Lightsail Connect. Whether you’re a developer, blogger, or website administrator, this guide will help you streamline your database management.


    Why Use Sequel Pro to Connect to Your WordPress Database?

    Sequel Pro is a popular, open-source MySQL database management tool for macOS. It offers a user-friendly interface, making it easy to manage your WordPress database, run queries, and perform backups. By connecting your WordPress database hosted on Amazon Lightsail to Sequel Pro, you can:

    • Easily manage your database without using the command line.
    • Run SQL queries to optimize your WordPress site.
    • Export or import data for backups or migrations.

    However, it’s important to note that Sequel Pro has some limitations, such as being available only for macOS. If you’re a Windows user, you’ll need to explore alternative tools like HeidiSQL or MySQL Workbench. Let’s dive into the steps to set up Sequel Pro Lightsail Connect on your Mac.


    Step 1: Install Sequel Pro on Your Mac

    Before you can connect to your WordPress database, you need to install Sequel Pro on your Mac. Here’s how:

    1. Download Sequel Pro: Visit the official Sequel Pro website and download the latest version for macOS.
    2. Install the Application: Once downloaded, drag the Sequel Pro icon to your Applications folder.
    3. Launch Sequel Pro: Open the application from your Applications folder or Spotlight search.

    Step 2: Access Your Amazon Lightsail Instance

    To connect Sequel Pro to your WordPress database, you’ll need the database credentials from your Amazon Lightsail instance. Follow these steps:

    1. Log in to Amazon Lightsail: Go to the Amazon Lightsail console and sign in with your credentials.
    2. Select Your Instance: Click on the WordPress instance you want to connect to.
    3. Access the Database: Under the “Connect” tab, note down the following details:
    • Endpoint (hostname)
    • Database name
    • Username
    • Password

    Step 3: Set Up an SSH Tunnel

    Since Amazon Lightsail databases are not publicly accessible, you’ll need to set up an SSH tunnel to connect securely. Here’s how:

    1. Open Sequel Pro: Launch the application on your Mac.
    2. Choose SSH Connection: In the connection window, select the “SSH” tab.
    3. Enter SSH Details:
    • SSH Host: Enter your Lightsail instance’s public IP address.
    • SSH User: Use bitnami as the default username.
    • SSH Password: Enter the password you use to connect to your Lightsail instance via SSH.
    1. Enter Database Details:
    • MySQL Host: Use 127.0.0.1.
    • Username: Enter the database username from Lightsail.
    • Password: Enter the database password.
    • Database: Enter the database name.
    1. Test the Connection: Click “Connect” to ensure everything is set up correctly.

    Step 4: Connect to Your WordPress Database

    Once the SSH tunnel is established, Sequel Pro will connect to your WordPress database. You’ll see a list of tables in your database, such as wp_posts, wp_users, and wp_options. From here, you can:

    • Run SQL queries to optimize your database.
    • Export or import data for backups or migrations.
    • Edit tables directly if needed.

    Step 5: Troubleshooting Common Issues

    If you encounter issues while setting up Sequel Pro Lightsail Connect, here are some common fixes:

    • SSH Connection Failed: Ensure your Lightsail instance’s firewall allows SSH connections (port 22).
    • Database Access Denied: Double-check your database username and password.
    • Slow Connection: Use a stable internet connection and ensure your Lightsail instance is in a region close to your location.

    Limitations of Sequel Pro

    While Sequel Pro is a powerful tool for macOS users, it does have some limitations:

    1. Not Available for Windows: Sequel Pro is exclusively designed for macOS, so Windows users will need to use alternatives like HeidiSQL or MySQL Workbench.
    2. No Native Support for Newer MySQL Features: Sequel Pro lacks support for some advanced MySQL features introduced in newer versions.
    3. Development Status: Sequel Pro’s development has been inconsistent in recent years, which may lead to compatibility issues with newer macOS versions.

    Final Thoughts

    Connecting your WordPress blog database to your Mac using Sequel Pro Lightsail Connect is a straightforward process that can significantly improve your workflow. By following this step-by-step guide, you’ll be able to manage your database efficiently, run queries, and ensure your WordPress site runs smoothly.

    Ready to take control of your WordPress database? Download Sequel Pro today and follow the steps above to get started. Have questions or need further assistance? Leave a comment below or explore our related guides on Netnaps for more tips and tricks!


    By following these steps, you’ll have a seamless Sequel Pro Lightsail Connect experience, making database management a breeze.

  • Lightsail SFTP Access With FileZilla Easily 5 Steps

    Saturday 8 August 01:09

    Getting Lightsail SFTP Access is Quite Easy

    Required Supply: Lightsail Account, Tools Needed: Filezilla

    In these short 5 Steps, we will learn How to get Lightsail SFTP Access or Connect Lightsail Instance to Filezilla using SFTP.

    To get access to the hosted file directory on the server.

    Also, find a command for setting up permissions to use at the end of this short tutorial.

    Lightsail SFTP Access Using FileZilla
    You can log in with your account on the Lightsail page :
    https://aws.amazon.com/lightsail/ Lightsail SFTP Access Using FileZilla.

    Step Click on your Instance

    click on lightsail
    Just click on your instance, to get started once you click it will show Connect Using SSH button

    Step 2 Scroll down and go to Account Page link

    account page lightsail
    Here you will find Keys of all the zones to connect via FTP

    Step 3 Download your Key File

    Download your key file
    This key is required to log in, keep this in a safe place after download.

    Step 4 Open FileZilla to Add a New Site

    open filezilla app
    Click on the extreme left top corner to add a new site.

    Step 5 Add the Details of New Site


    As we have explained in our screenshot, click on New Site ( No.1 Arrow ) Name Your Site,
    Select SFTP in the first option, and add your Lightsail Instance static IP / or public IP address.

    In Logon Type select key file, and the user is bitnami as you see in your SSH Terminal window, Add Key file location like normally you select a file.

    Then Connect, and it’s Done!

    Lightsail SFTP Access Bonus Tip – To Set Up Permissions.

    sudo chown -R bitnami:bitnami /opt/bitnami/apps/wordpress/htdocs/wp-content/

    This target folder could be anything wp-content is just for an example. If you need both users to have permissions, you can use bitnami: daemon and likewise.

    Without proper permission, you will not be able to upload any new file or make changes to your directory. You can still view the files.

    As in this above tutorial, we have signed in as bitnami, so the user is bitnami.

    Before you start your WordPress with any paid hosting, you can make it for free on your Mac, With this detailed tutorial here. Also, you can make this as a testing or development environment on your local mac.

    The tutorial for WordPress on a mac is free and also lets you get a free SSL if you wish to start an AMP Website or a Blog.

    I, too, am using Lightsail as a hosting and AMP on this blog! Powered by WordPress

  • Getting an A+ SSL Rating on Nginx Apache Server

    Saturday 8 August 15:18

    Getting A+ SSL Rating on Apache

    Getting an A+ SSL Rating on Lightsail is just a 5-minute task,

    It’s only turning off old versions of SSL from your configuration file.

    Getting a free SSL is well documented by the lightsail team here, in a 9 Step Tutorial, if you have not got an SSL please get one,

    SSL improves your SEO, maintains trust for the visitor and is a must for any website in 2020.

    After reading this post from Qualys, searching some more articles

    I could make out that getting A+ SSL rating and not allowing the previous versions of SSL on a website or a blog is both good for your SEO Strategy and Security part.

    So, here it is Get your site checked here on the Qualys Tool For SSL it’s Free!

    Here is a screenshot of a test when I just started this blog and was continuously improving on its security, SEO, and everything I could do for achieving a simple, secure and a pro website.

    SSL B Grade

    Getting the same as an A+ was just a 5 minutes task, from start to finish on a lightsail hosted website, using apache server, with bitnami image of wordpress.

    Here’s how I got this from B to A+

    Getting A+ Rating on SSL on a lightsail hosted website

    Just head over to your SSH Window and start with :

    sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

    Soon you are into editing the bitnami.conf file, so we have to just turn off the old versions of SSL

    Find this line with “CTRL+W”, or whatever that line reads near SSL Protocol

    SSLProtocol all -SSLv2 -SSLv3

    Change the same to

    SSLProtocol TLSv1.2

    CTRL+O to write out and CTRL+X to Exit

    Restart the Apache

    sudo /opt/bitnami/ctlscript.sh restart

    Getting A+ SSL Rating Nginx Server


    sudo nano /etc/nginx/nginx.conf

    Change the lines that start with #SSL Settings to Exactly the code below this would also add the session timeout and Strict Security Header :

        ##
    
        ssl_protocols TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        ##

    Once done just restart your server with :

    sudo service nginx reload && sudo service nginx restart

    This gives A+ SSL Rating.

    SSL is a must if you use AMP on your WordPress Blog. , Also here’s a collection of some website testing tools that I keep on updating.

    HSTS Preload on NGINX Server

    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;

    This gives you a HSTS Header on your site, if you use Nginx Server, Enrolling to HSTS list is good for your sites security, this enables browsers to understand that your site is only served on a secured connection.

    You can enrol here for HSTS, First, you need to test on the same link then Enroll the domain.

    HSTS Preload on APACHE Server

    Mod Headers Looks Like :

    First, enable mod headers in your httpd.conf file,

    you can find in the /etc/apache2/httpd.conf :

    LoadModule headers_module modules/mod_headers.so
    

    then simply add the below line in your virtual host’s file.

    <VirtualHost *:443>
    ...
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
    ...
    </VirtualHost>
  • SSH Command Collection for WordPress on Amazon Lightsail

    SSH Command Collection for WordPress on Amazon Lightsail: A Beginner’s Guide

    Managing a WordPress site on Amazon Lightsail requires more than just a basic understanding of the platform. SSH (Secure Shell) is a powerful tool that allows you to interact with your server directly, perform maintenance tasks, upgrade software, and troubleshoot issues. Whether you’re a beginner or an experienced user, having a handy collection of SSH commands can save you time and effort. In this article, we’ll cover essential SSH commands for WordPress users, including maintenance, upgrades, SSL configuration, and more.


    Why SSH is Crucial for WordPress on Amazon Lightsail

    SSH is a secure protocol that lets you access your server’s command line interface (CLI). For WordPress users on Amazon Lightsail, SSH is invaluable for:

    • Performing server maintenance.
    • Upgrading WordPress core, plugins, and themes.
    • Configuring SSL certificates.
    • Debugging and troubleshooting issues.
    • Managing files and databases.

    How to Connect to Amazon Lightsail via SSH

    Before diving into the commands, you need to connect to your Lightsail instance:

    1. Download your private key from the Lightsail console.
    2. Open your terminal (on macOS/Linux) or use an SSH client like PuTTY (on Windows).
    3. Run the following command:
       ssh -i /path/to/your/private-key.pem bitnami@your-server-ip

    Replace /path/to/your/private-key.pem with the path to your private key and your-server-ip with your server’s public IP address.


    Essential SSH Commands for WordPress on Amazon Lightsail

    Here’s a comprehensive list of SSH commands categorized for easy reference:


    1. Basic Navigation and File Management

    • pwd
      Explanation: Print the current working directory.
      Use Case: Find out where you are in the file system.
    • ls
      Explanation: List files and directories in the current folder.
      Use Case: View the contents of a directory.
    • cd /path/to/directory
      Explanation: Change the current directory.
      Use Case: Navigate to a specific folder.
    • touch filename.txt
      Explanation: Create an empty file.
      Use Case: Quickly create a new file.
    • mkdir foldername
      Explanation: Create a new directory.
      Use Case: Organize files into folders.
    • rm filename.txt
      Explanation: Delete a file.
      Use Case: Remove unnecessary files.
    • rm -r foldername
      Explanation: Delete a directory and its contents.
      Use Case: Remove an entire folder.
    • cp file1.txt file2.txt
      Explanation: Copy a file.
      Use Case: Duplicate files for backup or editing.
    • mv file1.txt /new/location/file1.txt
      Explanation: Move or rename a file.
      Use Case: Reorganize files or change their names.

    2. File Editing and Permissions

    • nano filename.txt
      Explanation: Open a file in the Nano text editor.
      Use Case: Edit configuration files or scripts.
    • cat filename.txt
      Explanation: Display the contents of a file.
      Use Case: Quickly view file content.
    • chmod 644 filename.txt
      Explanation: Change file permissions.
      Use Case: Set read/write permissions for files.
    • chown user:group filename.txt
      Explanation: Change file ownership.
      Use Case: Assign ownership to specific users or groups.

    3. WordPress-Specific Commands

    • wp --info
      Explanation: Check if WP-CLI is installed and view its details.
      Use Case: Verify WP-CLI availability.
    • wp core update
      Explanation: Update WordPress core.
      Use Case: Keep your WordPress installation up to date.
    • wp plugin update --all
      Explanation: Update all installed plugins.
      Use Case: Ensure plugins are running the latest versions.
    • wp theme update --all
      Explanation: Update all installed themes.
      Use Case: Keep themes updated for security and performance.
    • wp db export backup.sql
      Explanation: Export the WordPress database.
      Use Case: Create a database backup.
    • wp db import backup.sql
      Explanation: Import a database backup.
      Use Case: Restore your database.

    4. Server Maintenance

    • sudo apt update
      Explanation: Update the package list.
      Use Case: Ensure your server has the latest package information.
    • sudo apt upgrade
      Explanation: Upgrade installed packages.
      Use Case: Keep your server software up to date.
    • sudo service apache2 restart
      Explanation: Restart the Apache web server.
      Use Case: Apply changes to server configurations.
    • sudo service mysql restart
      Explanation: Restart the MySQL database server.
      Use Case: Refresh the database service.
    • df -h
      Explanation: Display disk space usage.
      Use Case: Monitor server storage.
    • top
      Explanation: View real-time system processes.
      Use Case: Identify resource-heavy processes.

    5. SSL Configuration

    • sudo certbot --apache
      Explanation: Install an SSL certificate using Certbot.
      Use Case: Secure your site with HTTPS.
    • sudo certbot renew --dry-run
      Explanation: Test SSL certificate renewal.
      Use Case: Ensure your SSL certificates renew automatically.

    6. Debugging and Logs

    • tail -f /var/log/apache2/error.log
      Explanation: View the Apache error log in real-time.
      Use Case: Debug server errors.
    • tail -f /opt/bitnami/wordpress/wp-content/debug.log
      Explanation: View the WordPress debug log.
      Use Case: Troubleshoot WordPress-specific issues.

    Tips for Using SSH Commands Safely

    1. Backup Before Making Changes: Always back up your site and database before running commands that modify files or settings.
    2. Use Sudo Wisely: The sudo command grants administrative privileges. Use it carefully to avoid accidental changes.
    3. Test Commands: Test commands on a staging site before applying them to your live site.
    4. Keep Learning: Explore advanced commands and scripting to automate tasks.

    Conclusion

    SSH is an indispensable tool for managing your WordPress site on Amazon Lightsail. With this collection of essential SSH commands, you can handle everything from basic file management to advanced server maintenance, upgrades, and SSL configuration. Whether you’re a beginner or an experienced user, these commands will help you take control of your server and optimize your website’s performance.

    Have you used any of these commands before? Share your experience or ask questions in the comments below!


  • Backup Lightsail instance with free SnapShots in 3 Steps

    Amazon Lightsail is a popular cloud platform that offers simple virtual private servers (VPS) for developers, small businesses, and hobbyists. While Lightsail makes it easy to deploy and manage servers, backing up your instance is crucial to protect your data and ensure business continuity. Fortunately, Lightsail provides a free and straightforward way to create backups using Snapshots. In this article, we’ll walk you through how to back up your Lightsail instance in just 3 simple steps.


    Why Backup Your Lightsail Instance?

    Before diving into the steps, let’s understand why backups are essential:

    1. Data Protection: Accidental deletions, corruption, or hardware failures can lead to data loss.
    2. Disaster Recovery: In case of a server crash or cyberattack, backups ensure you can restore your system quickly.
    3. Cost-Effective: Lightsail offers free snapshots for the first snapshot per instance, making it an affordable solution.

    Now, let’s get started!


    Step 1: Log in to Your AWS Lightsail Console

    1. Go to the AWS Lightsail Console.
    2. Log in with your AWS credentials. If you don’t have an AWS account, you’ll need to create one.
    3. Once logged in, you’ll see a list of your Lightsail instances. Select the instance you want to back up.

    Step 2: Create a Snapshot of Your Instance

    1. Navigate to the Snapshots Tab:
    • In the Lightsail dashboard, click on the instance you want to back up.
    • Go to the Snapshots tab in the instance management section.
    1. Create a Snapshot:
    • Click the Create Snapshot button.
    • Give your snapshot a meaningful name (e.g., MyInstance-Backup-Oct2023).
    • Click Create to start the snapshot process.
    1. Wait for the Snapshot to Complete:
    • The snapshot creation process may take a few minutes, depending on the size of your instance.
    • You can monitor the progress in the Snapshots tab.

    Step 3: Restore or Manage Your Snapshots

    Once your snapshot is created, you can use it to restore your instance or create a new instance from the backup. Here’s how:

    1. Restore an Instance:
    • Go to the Snapshots tab.
    • Select the snapshot you want to restore.
    • Click Create New Instance to spin up a new instance from the snapshot.
    1. Delete Old Snapshots:
    • If you no longer need a snapshot, you can delete it to free up space.
    • Go to the Snapshots tab, select the snapshot, and click Delete.
    1. Automate Snapshots (Optional):
    • Lightsail allows you to enable automatic snapshots for daily backups.
    • Go to the Snapshots tab and toggle the Enable Automatic Snapshots option.

    Benefits of Using Lightsail Snapshots

    • Free for the First Snapshot: Lightsail offers the first snapshot per instance for free, making it a cost-effective backup solution.
    • Easy to Use: The process is simple and doesn’t require technical expertise.
    • Quick Recovery: Snapshots allow you to restore your instance in minutes, minimizing downtime.

    Tips for Effective Backup Management

    1. Regular Backups: Create snapshots regularly to ensure your data is always protected.
    2. Name Your Snapshots: Use descriptive names to easily identify backups.
    3. Enable Automatic Snapshots: Automate the process to avoid forgetting manual backups.
    4. Test Your Backups: Periodically restore a snapshot to ensure it works as expected.

    Conclusion

    Backing up your Lightsail instance with snapshots is a simple yet powerful way to safeguard your data and ensure business continuity. With just 3 easy steps—logging in, creating a snapshot, and managing your backups—you can protect your server from data loss and disasters. Plus, with the first snapshot being free, there’s no reason not to get started today!

    Have you tried using Lightsail snapshots? Share your experience or any tips in the comments below!