Froxlor – How to setup LetsEncrypt Free SSL – PHP-FPM – Nginx – Ubuntu 18.04

Froxlor is a open source server management software that allows you to manage your virtual server.

Article only covers steps to setup LetsEncrypt (LE) with following setup

  • Ubuntu 18.04
  • Php-fpm
  • Nginx

This article assumes you have installed Froxlor and configured. Once you have everything running you are now ready to setup LE. To follow along with this article you will need root or sudo access to your server.

Step 1: Create a Self Signed Certificate

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

You will be prompt to provide some basic information for your company. Those information will be used to setup the certificate. For Common Name (e.g. server FQDN or YOUR name use your server domain name or IP address. Once you fill out all information openssl will create the self signed ssl certificate for you. now keep note of key and crt file path as we will need both of them in just a little while.

  • Certificate path: /etc/ssl/certs/nginx-selfsigned.crt
  • SSL Key file path: /etc/ssl/private/nginx-selfsigned.key

You can find more detailed article on creating self signed SSL certificate in Digitalocean blog.

Step 2: Froxlor – Create IP/Port for SSL

Login into your Froxlor Admin panel and go to Resources > IPs and Ports. If you have not setup any ports/IPs you should see only one entry with your server IP with port 80.

  1. Copy the IP address of your server and click Add IP/Port.
  2. Paste IP on the IP field.
  3. Put 443 in Port field.
  4. Scroll down to Webserver SSL config
    1. Check Is this an SSL port
    2. Paste Certificate path you created previously into Path to SSL Certificate Field
    3. Paste Keyfile path into Path to SSL Keyfile Field
  5. Save

Now you are mostly done with the ssl settings you need for Froxlor. Next we are going to setup Letsencrypt (LE) settings.

Step 3: Enable SSL For Server

Go to System > Settings, Set SSL settings to YES.

Step 4: Letsencrypt Settings For Your Domain

Now find the domain you want to setup LE cert and edit.

  1. Find ServerAlias value for the domain under Webserver settings and make sure you select WWW (www.domain.tld) Current version of Froxlor doesn’t let you select wildcard.
  2. Scroll down to Webserver SSL Settings and setup following
    1. Check Enable Uses of SSL to YES
    2. Check SSL IP Addresss(es)
    3. Use Letsencrypt to Yes
    4. You can keep everything else to default.
  3. Save.

Now wait about 10 mins, Froxlor will run cronjob to reflect all changes in your server. Let me know in the comment box if you face any problem.

 

How to Prevent WordPress from Generating Image Sizes (Thumbnails)

When you use WordPress themes and plugins. They may have lots of image sizes registered. While image size is very useful feature of WordPress you may not need it for all cases.

I recently have a similar case where I allowed subscribers to upload images but they will never need various size images that WP will generate. They will only need the original size.

This small piece of code will prevent WordPress from generating image sizes. Off course I have added conditionals so only subscribers image upload will be affected.

If you use any thumbnail regenerate plugin. It may completely skip this code depending on how the plugin using the function. You may need to re-adjust the logic in order to cope with that.

PHP Code

add_filter('image_resize_dimensions', 'subscribers_image_resize_dimensions');

function subscribers_image_resize_dimensions( $output ){

    // do not create thumbnails for subscriber uploaded images.
    if( current_user_can( 'subscriber' ) ) {
        return false;
    }

    return $output;

}