How To Set Up a Firewall with UFW on Ubuntu 18.04

Step 1 — Using IPv6 with UFW (Optional)

This tutorial is written with IPv4 in mind, but will work for IPv6 as well as long as you enable it. If your Ubuntu server has IPv6 enabled, ensure that UFW is configured to support IPv6 so that it will manage firewall rules for IPv6 in addition to IPv4. To do this, open the UFW configuration with nano or your favorite editor.

  • sudo nano /etc/default/ufw

Then make sure the value of IPV6 is yes. It should look like this:

/etc/default/ufw excerpt

Save and close the file. Now, when UFW is enabled, it will be configured to write both IPv4 and IPv6 firewall rules. However, before enabling UFW, we will want to ensure that your firewall is configured to allow you to connect via SSH. Let’s start with setting the default policies.

  • sudo ufw allow 443
  • sudo ufw allow https


Step 4 — Enabling UFW

To enable UFW, use this command:

  • sudo ufw enable

You will receive a warning that says the command may disrupt existing SSH connections. We already set up a firewall rule that allows SSH connections, so it should be fine to continue. Respond to the prompt with y and hit ENTER.

Javascript OCR Pdf-to-text


PDF-to-Text is an OCR, Pure Javascript by tesseract.js api, mobile-ready that convert PDF text-image to text.


PDF-to-Text uses a number of open source projects to work properly:

  • [JavaScript] – awesome!
  • [HTML] – HTML enhanced for web apps!
  • [CSS] – Fence!
  • [Magic] – that”s nice!


PDF-to-Text requires Node.js v4+ or any server enviroment to run.

Start the server.

$ npm install http-server -g
$ cd pdf-to-text-master
$ http-server

Embedding YouTube Video with High Quality Thumbnail

In the above example, the original code for embedding provided by YouTube is like this.

<iframe width="1280" height="720" src="" frameborder="0" allowfullscreen></iframe>

We now change it to this.

<iframe width="1280" height="720" src="" frameborder="0" allowfullscreen></iframe>

$thumbnail.on('click', function(e){
src = src+'&autoplay=1'; // src: the original URL for embedding
$videoContainer.empty().append( $iframe.clone().attr({'src': src}) ); // $iframe: the original iframe for embedding


To see the demo, please go to the portfolio section of the Jordan template and click the third thumbnail.


View jQuery plugin  | code