Skip to content

Instantly share code, notes, and snippets.

View evgeniidatsiuk's full-sized avatar
🦸‍♂️
IT Iron Man

Yevhenii Datsiuk evgeniidatsiuk

🦸‍♂️
IT Iron Man
View GitHub Profile
@evgeniidatsiuk
evgeniidatsiuk / registrations_controller.rb
Created December 29, 2019 22:31 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@evgeniidatsiuk
evgeniidatsiuk / Nginx
Created February 16, 2020 21:30 — forked from YarikST/Nginx
#acme
location ^~/.well-known {
default_type "text/plain";
root /var/www/html;
}
events {
worker_connections 768; #10000 Load balancer
multi_accept on;
}
#Load balancer redirect http to https and http to www-version
function gen_ssl_cert {
local prefix="${1}"
openssl genrsa -des3 -out "${prefix}.lock.key" 1024
openssl rsa -in "${prefix}.lock.key" -out "${prefix}.key"
rm "${prefix}.lock.key"
openssl req -new -key "${prefix}.key" -out "${prefix}.csr"
openssl x509 -req -days 3650 -in "${prefix}.csr" -signkey "${prefix}.key" -out "${prefix}.crt"
openssl pkcs12 -export -inkey "${prefix}.key" -in "${prefix}.crt" -out "${prefix}.pfx"