Skip to content

Instantly share code, notes, and snippets.

View saniaky's full-sized avatar
👋

Alexander saniaky

👋
  • Web
  • Online
View GitHub Profile
@saniaky
saniaky / Readme.md
Last active April 23, 2024 00:42
Docker + nginx-proxy + let's encrypt + watchtower + fail2ban

Complete solution for websites hosting

This gist contains example of how you can configure nginx reverse-proxy with autmatic container discovery, SSL certificates generation (using Let's Encrypt) and auto updates.

Features:

  • Automatically detect new containers and reconfigure nginx reverse-proxy
  • Automatically generate/update SSL certificates for all specified containers.
  • Watch for new docker images and update them.
  • Ban bots and hackers who are trying to bruteforce your website or do anything suspicious.
@saniaky
saniaky / CheckPort.java
Last active February 21, 2023 16:16
Check if port is open
public static boolean serverListening(String host, int port) {
Socket s = null;
try {
s = new Socket(host, port);
log.info("OK -> HOST: {}, PORT: {}", host, port);
return true;
} catch (Exception e) {
log.info("CLOSED -> HOST: {}, PORT: {}", host, port);
return false;