How to configure Nginx SSL/TLS passthrough with TCP load balancing

Here’s how you can configure Nginx to perform SSL/TLS passthrough with TCP load balancing: Install Nginx: sudo apt-get update sudo apt-get install nginx Create a new Nginx configuration file in the sites-available directory: sudo nano /etc/nginx/sites-available/<your_site> Replace <your_site> with the desired name for your site. Add the following content to the file to configure Nginx … Read more

How to install tinc VPN on Ubuntu Linux 16.04 LTS

Here’s how you can install tinc VPN on Ubuntu Linux 16.04 LTS: Update your system: sudo apt-get update sudo apt-get upgrade Install tinc VPN: sudo apt-get install tinc Create a tinc network: sudo mkdir /etc/tinc/<network_name> sudo tincd -n <network_name> -K Replace <network_name> with the desired name for your tinc network. Create a configuration file for … Read more

How to allow root login from one IP address with ssh public keys only

Here’s how you can allow root login from one IP address using SSH public keys in a Linux environment: Make sure the target machine has an SSH server installed, such as OpenSSH. On the target machine, open the SSH configuration file, typically located at /etc/ssh/sshd_config. Find the line that starts with PermitRootLogin and set it … Read more

How to prevent sed -i command overwriting my symlinks on Linux or Unix

The sed -i command on Linux and Unix systems can overwrite symbolic links (symlinks) if not used with caution. To prevent sed -i from overwriting symlinks, you can use the following methods: Use a temporary file: sed ‘s/old-text/new-text/g’ inputfile > tempfile && mv tempfile inputfile This method creates a temporary file, modifies its content, and … Read more

How To Install Linux, Apache, MySQL, PHP (LAMP) Stack on Debian 9 Stretch

Here are the steps to install the LAMP stack on Debian 9 Stretch: Install Apache Web Server: sudo apt-get update sudo apt-get install apache2 Install MySQL Server: sudo apt-get install mysql-server During the installation, you’ll be prompted to set a root password for MySQL. Install PHP: sudo apt-get install php libapache2-mod-php php-mysql Configure Apache to … Read more

How to upgrade from Debian Linux 8 Jessie to Debian 9 Stretch using command line over ssh based session

To upgrade from Debian Linux 8 Jessie to Debian 9 Stretch using command line over an SSH-based session, follow these steps: Log in to your Jessie system using SSH: ssh user@hostname Update the package index: sudo apt-get update Upgrade the system to the latest version of Jessie: sudo apt-get upgrade Make a backup of important … Read more

How to redirect non-www to www HTTP / TLS /SSL traffic on Nginx

Here is a simple Nginx configuration to redirect non-www traffic to www with HTTPS: server { listen 80; server_name example.com; return 301 https://www.example.com$request_uri; } server { listen 443 ssl; server_name example.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/cert.key; return 301 https://www.example.com$request_uri; } server { listen 443 ssl; server_name www.example.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/cert.key; # Add your website configuration … Read more