Configure KVM Bridge Network on Debian 10

Before you configure bridge network, make sure you have bridge-utils installed.

You may also need ifdown and resolvconf packages installed

Here is the default /etc/network/interfaces i had on the server

enp1s0f0 is name of the network interface card on the server.

To convert it to brudge configuration. You need to replace enp1s0f0 with br0.

Then add following to the file

Remember to replace enp1s0f0 with your actual network card interface name.

Also remove the line

Here is the final /etc/network/interface file i have.

Bash Script to Monitor Disk Usage

This script will check disk usage on / partition and email you if disk usage is above 80%

We can use df / command to find current disk usage

As you can see, the result have 2 lines. We don’t need first line. To ignore first line, we can use

From the result, we only need the Use% part. In this case 66%, to find this, you can use awk command, that split the line, then prient specified part. In our case, we need 5th part.

To use disk usage % in our script for calculation, we need it converted to number. That is remove %. This can be done with sed command

Now we have disk usage as a number. We can use it in our script.

Add following content to it

In above script, replace YOUR_EMAIL_HERE with your email address.

disk usage bash script

You can run the script daily using cronjob. If disk usage ever go above 80%, you will get email alert.

See bash

Enable CORS in Nginx

To enable CORS in nginx, add following inside web sites sevrer config.

Restart nginx

See CORS

Enable CORS in Apache

To enable CORS in apache, add following in VirtualHost or .htaccess

If your apache installation don’t have mod_headers installed, you need it enabled with