Skip to content

Instantly share code, notes, and snippets.

View ptts's full-sized avatar
🏠
Working from home

Patrick ptts

🏠
Working from home
View GitHub Profile
@alysivji
alysivji / keybindings.json
Last active September 18, 2020 15:21
VSCode Settings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+g",
"command": "editor.foldAll",
"when": "editorTextFocus"
},
{
"key": "cmd+h",
"command": "editor.unfoldAll",
@allebb
allebb / create_php_site.sh
Created September 12, 2017 15:54 — forked from jun9/create_php_site.sh
Nginx and PHP-FPM, bash script for creating new vhost’s under separate fpm pools
#!/bin/bash
# @author: Seb Dangerfield
# http://www.sebdangerfield.me.uk/?p=513
# Created: 11/08/2011
# Modified: 07/01/2012
# Modified: 17/05/2012
# Modify the following to match your system
NGINX_CONFIG='/etc/nginx/sites-available'
NGINX_SITES_ENABLED='/etc/nginx/sites-enabled'
Source: https://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html
This page collects hints how to improve the security of nginx web servers running on Linux or UNIX-like operating systems.
Default Config Files and Nginx Port
/usr/local/nginx/conf/ or /etc/nginx/– The nginx server configuration directory and /usr/local/nginx/conf/nginx.conf is main configuration file.
/usr/local/nginx/html/ or /var/www/html– The default document location.
/usr/local/nginx/logs/ or /var/log/nginx – The default log file location.
Nginx HTTP default port : TCP 80
@theMiddleBlue
theMiddleBlue / telegram_webhook.php
Created December 22, 2016 08:06
PHP Telegram Webhook
<?php
if(!preg_match('/^149\.154\.167\.(19[7-9]|20[0-9]|21[0-9]|22[0-9]|23[0-3])$/', $_SERVER['REMOTE_ADDR'])) {
die('IP Address not allowed.');
}
if($_SERVER['REQUEST_METHOD'] != 'POST') {
die('Request method not allowed.');
}
$token = '<bot token here>';
@markcwebster
markcwebster / neverssl.html
Created October 24, 2016 17:30
Some CSS for NeverSSL
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>NeverSSL - Helping You Get Online</title>
<style>
body {
font-family: Montserrat, helvetica, arial, sans-serif;
font-size: 16x;
color: #444444;
@nrollr
nrollr / nginx.conf
Last active April 22, 2024 15:11
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@deviantony
deviantony / install-latest-compose.sh
Last active April 20, 2024 22:39
Install latest version of Docker Compose
#!/bin/bash
## THIS IS THE OLD WAY
## Nowadays, simply follow the Compose installation instructions in the official documentation:
## https://docs.docker.com/compose/install/
# get latest docker compose released tag
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)
@lachesis
lachesis / letsencrypt_notes.sh
Last active December 13, 2023 11:02
Set up LetsEncrypt using acme.sh without root
# How to use "acme.sh" to set up Lets Encrypt without root permissions
# See https://github.com/Neilpang/acme.sh for more
# This assumes that your website has a webroot at "/var/www/<domain>"
# I'll use the domain "EXAMPLE.com" as an example
# When this is done, there will be an "acme" user that handles issuing,
# updating, and installing certificates. This account will have the following
# (fairly minimal) permissions:
# - Host files at http://EXAMPLE.com/.well-known/acme-challenge
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@parmentf
parmentf / GitCommitEmoji.md
Last active May 2, 2024 16:53
Git Commit message Emoji