Install NVIDIA 340.108 Driver on Ubuntu

Install NVIDIA proprietary drivers on Debian / Ubuntu / Linux Mint / LMDE and disable the nouveau driver

Make sure that you system is up-to-date and you are running latest kernel, also make sure that you don’t have any Debian / Ubuntu / Linux Mint / LMDE NVIDIA package installed

## Ubuntu / Debian / Linux Mint / LMDE ##
apt update

apt upgrade

## Debian and Linux Mint ##
apt autoremove $(dpkg -l nvidia-driver* |grep ii |awk '{print $2}')

## Ubuntu ##
apt autoremove $(dpkg -l xserver-xorg-video-nvidia* |grep ii |awk '{print $2}')

apt reinstall xserver-xorg-video-nouveau

Install needed dependencies

## Ubuntu / Debian / Linux Mint ##
apt install linux-headers-$(uname -r) gcc make acpid dkms libglvnd-core-dev libglvnd0 libglvnd-dev dracut wget patch libgtk2.0-0

Disable nouveau

Create or edit /etc/modprobe.d/blacklist.conf

Append ‘blacklist nouveau’

echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf

Edit /etc/default/grub

Append ‘rd.driver.blacklist=nouveau’ to end of ‘GRUB_CMDLINE_LINUX=”…”‘.

## Example row on Debian ##
GRUB_CMDLINE_LINUX_DEFAULT="quiet rd.driver.blacklist=nouveau"

## OR with Ubuntu and Linux Mint ##
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash rd.driver.blacklist=nouveau"

Update grub2 conf

## BIOS and UEFI ##
update-grub2

Generate initramfs

## Backup old initramfs nouveau image ##
mv /boot/initrd.img-$(uname -r) /boot/initrd.img-$(uname -r)-nouveau
 
## Generate new initramfs image ##
dracut -q /boot/initrd.img-$(uname -r) $(uname -r)

Create new directory for inttf NVIDIA patcher

cd ~
mkdir NVIDIA
cd NVIDIA

Download / Update inttf NVIDIA patcher

wget -O inttf-nvidia-patcher.sh https://nvidia.if-not-true-then-false.com/patcher/inttf-nvidia-patcher.sh

Make inttf NVIDIA patcher executable

chmod +x inttf-nvidia-patcher.sh

Download and patch your drivers

./inttf-nvidia-patcher.sh -v 340.108

Reboot to runlevel 3

systemctl set-default multi-user.target

reboot

Run NVIDIA Binary

./NVIDIA-Linux-x86_64-340.108-patched-kernel-5.15.run
systemctl set-default graphical.target

reboot

References
https://www.if-not-true-then-false.com/2021/debian-ubuntu-linux-mint-nvidia-guide/
https://www.if-not-true-then-false.com/2020/inttf-nvidia-patcher/

Allow Incoming Connection from Specific IP Address or Subnet in UFW

Allow Incoming SSH from Specific IP Address or Subnet

sudo ufw allow from 15.15.15.0/24  to any port 22
sudo ufw allow from 15.15.15.65 to any port 22

Allow Incoming Rsync from Specific IP Address or Subnet

sudo ufw allow from 15.15.15.0/24 to any port 873

Allow All Incoming HTTP and HTTPS

sudo ufw allow proto tcp from any to any port 80,443

Allow MySQL from Specific IP Address or Subnet

sudo ufw allow from 15.15.15.0/24 to any port 3306

Allow MySQL to Specific Network Interface

sudo ufw allow in on eth1 to any port 3306

References
https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands

Host ASP.NET Core on Linux with Apache

dotnet add package Microsoft.AspNetCore.HttpOverrides

Configure a proxy server

Invoke the UseForwardedHeaders method at the top of Startup.Configure before calling other middleware. Configure the middleware to forward the X-Forwarded-For and X-Forwarded-Proto headers:

// using Microsoft.AspNetCore.HttpOverrides;

app.UseForwardedHeaders(new ForwardedHeadersOptions
{
    ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});

app.UseAuthentication();
// using System.Net;

services.Configure<ForwardedHeadersOptions>(options =>
{
    options.KnownProxies.Add(IPAddress.Parse("10.0.0.100"));
});

Forwarded Headers Middleware order

Forwarded Headers Middleware should run before other middleware. This ordering ensures that the middleware relying on forwarded headers information can consume the header values for processing. Forwarded Headers Middleware can run after diagnostics and error handling, but it must be run before calling UseHsts:

using Microsoft.AspNetCore.HttpOverrides;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
    options.ForwardedHeaders =
        ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});

var app = builder.Build();

if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    app.UseForwardedHeaders();
    app.UseHsts();
}
else
{
    app.UseDeveloperExceptionPage();
    app.UseForwardedHeaders();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseAuthorization();

app.MapRazorPages();

app.Run();

Alternatively, call UseForwardedHeaders before diagnostics:

using Microsoft.AspNetCore.HttpOverrides;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
    options.ForwardedHeaders =
        ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});

var app = builder.Build();

app.UseForwardedHeaders();

if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseAuthorization();

app.MapRazorPages();

app.Run();

Forwarded Headers Middleware options

using System.Net;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
    options.ForwardLimit = 2;
    options.KnownProxies.Add(IPAddress.Parse("127.0.10.1"));
    options.ForwardedForHeaderName = "X-Forwarded-For-My-Custom-Header-Name";
});

var app = builder.Build();

app.UseForwardedHeaders();

if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseAuthorization();

app.MapRazorPages();

app.Run();

References
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-5.0
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-6.0