Skip to content

Instantly share code, notes, and snippets.

View xuyuji9000's full-sized avatar

Karl Xu xuyuji9000

  • Shanghai, China
View GitHub Profile
@xuyuji9000
xuyuji9000 / test-nginx-proxy.yml
Created November 19, 2017 13:15
File name should be docker-compose.yml
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
grant all privileges on *.* to 'root'@'%' identified by 'xuyuji';
flush privileges;
#!/bin/bash
apt update && apt install ebtables ethtool -y
apt update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt update && apt install -y kubelet kubeadm kubectl
#!/bin/bash
# install docker
apt update
apt install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common -y
INSERT INTO users (name) VALUES ('Karl');
CREATE TABLE users (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varchar(100) NOT NULL
);
server {
listen 80;
server_name ssl2.yogiman.cn;
location /.well-known {
allow all;
}
location / {
return 301 https://$server_name$request_uri;
#!/bin/bash
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot -y
@xuyuji9000
xuyuji9000 / letsencrypt_2017.md
Created September 27, 2017 14:39 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

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

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

#!/bin/bash
sudo curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer