Skip to content

Instantly share code, notes, and snippets.

### -----------------------------------------------------------
### THE NGINX ULTIMATE BAD BOT, BAD IP AND BAD REFERRER BLOCKER
### -----------------------------------------------------------
### VERSION INFORMATION #
###################################################
### Version: V4.2021.06.2380
### Updated: Tue Jun 15 09:09:44 SAST 2021
### Bad Referrer Count: 7062
### Bad Bot Count: 615
annotations:
nginx.ingress.kubernetes.io/ssl-passthrough: 'true'
nginx.ingress.kubernetes.io/backend-protocol: 'HTTPS'
@nguyen127001
nguyen127001 / gist:a502a1eb71777df6f9135303030ede8a
Last active September 8, 2023 03:17
Nginx - TCP load balancing
Địa chỉ file cấu hình:
/etc/nginx/passthrough.conf
```
stream {
upstream nginxlb {
server IP1:PORT1 max_fails=3 fail_timeout=10s; # đổi IP PORT
server IP2:PORT2 max_fails=3 fail_timeout=10s; # đổi IP PORT
}
@nguyen127001
nguyen127001 / openssl_commands.md
Created July 8, 2021 08:08 — forked from Hakky54/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl 🔐

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@nguyen127001
nguyen127001 / script.sh
Created May 25, 2021 16:50 — forked from vielhuber/script.sh
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@nguyen127001
nguyen127001 / sftp-ubuntu.md
Created May 14, 2021 03:24 — forked from lymanlai/sftp-ubuntu.md
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h

@nguyen127001
nguyen127001 / nginx.conf
Created May 6, 2021 03:04 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@nguyen127001
nguyen127001 / file0.txt
Last active April 28, 2021 02:30 — forked from na0AaooQ/file0.txt
AWS EC2インスタンス CloudWatch Logs(awslogs)インストールとCloudWatch保存対象ログの追加 ref: http://qiita.com/na0AaooQ/items/a3b0e5384399b66b742b
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"logs:*"
],
"Effect": "Allow",
"Resource": "*"
}
@nguyen127001
nguyen127001 / root-password-MariaDB-docker-compose.md
Created April 8, 2021 17:54 — forked from rordi/root-password-MariaDB-docker-compose.md
Change root password in MariaDB Docker container running with docker-compose

Override the entrypoint in docker-compose.yml for the MariaDB Docker container by adding:

entrypoint: mysqld_safe --skip-grant-tables --user=mysql

The start up the Docker Compose stack:

$> docker-compose up -d

Then login to the Docker container:

@nguyen127001
nguyen127001 / systemd-cloudwatch-logs-tutorial.md
Created March 23, 2021 08:11 — forked from adam-hanna/systemd-cloudwatch-logs-tutorial.md
Forward systemd service logs to AWS Cloudwatch

Introduction

I often find myself ssh'ing into my servers and checking my systemd service logs with $ journalctl -f -u {name}.service. One day I got tired of this and wanted all of my important logs in once place (Amazon AWS Cloudwatch). To my dismay, there weren't any real good tutorials on how to do so. So, voilà.

Steps

Overall, it's a fairly simple process consisting of the following few steps.

1. Modify the service file

Open the service file with $ sudo vi /lib/systemd/system/{name}.service

Modify the [Service] section: