Skip to content

Instantly share code, notes, and snippets.

View rbrto's full-sized avatar

Roberto Esparza rbrto

View GitHub Profile
@rbrto
rbrto / pedantically_commented_playbook.yml
Created April 29, 2017 20:07 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@rbrto
rbrto / README.md
Created June 17, 2017 20:06 — forked from joyrexus/README.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@rbrto
rbrto / nginx.conf
Created September 8, 2017 18:15 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@rbrto
rbrto / deploy.yml
Created September 14, 2017 18:08 — forked from caalberts/deploy.yml
Ansible Playbook to Deploy Rails to AWS
---
# Deploy rails app from localhost to remote servers
- name: Set up AWS infrastructure
hosts: localhost
connection: local
roles:
- setup_aws
- name: Package app
@rbrto
rbrto / letsencrypt_2017.md
Created October 5, 2017 23:58 — 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.

@rbrto
rbrto / gist:dd927e1a3125c68a4636e4e8967933f5
Created November 18, 2017 23:54 — forked from alinpopa/gist:1281448
elasticsearch analyzer example - Test Queries
# Index
---------------------------------------------------------------------
curl -XPUT http://localhost:9200/pictures/ -d '
{
"settings": {
"analysis": {
"analyzer": {
"index_analyzer": {
"tokenizer": "standard",
#!/bin/sh
echo "\n --- delete index"
curl -X DELETE 'http://localhost:9200/'
echo "\n --- create index and put mapping into place"
curl -X POST 'http://localhost:9200/myindex/' -d '{
"mappings" : {
"person" : {
"properties" : {
@rbrto
rbrto / nginx-letsencrypt-vhost.conf
Created December 14, 2017 15:22 — forked from cleot/nginx-letsencrypt-vhost.conf
nginx vhost - letsencrypt
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com *.example.com;
include global/letsencrypt-redirect.conf;
}
server {
listen 443 ssl http2;
@rbrto
rbrto / nginxproxy.md
Created December 19, 2017 23:15 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

certbot revoke -d your-site.com -d your-site.net