Skip to content

Instantly share code, notes, and snippets.

@SalahAdDin
Last active February 8, 2018 15:34
Show Gist options
  • Save SalahAdDin/d15a543bb9481452c7aa628816732f96 to your computer and use it in GitHub Desktop.
Save SalahAdDin/d15a543bb9481452c7aa628816732f96 to your computer and use it in GitHub Desktop.
Useful commands

Crontab

export EDITOR=nano
crontab -e
crontab -l

Docker

  • docker-compose up
  • docker-compose down
  • docker exec -it $container_name bash
  • docker exec -it $container_name bash -c 'python manage.py $command'
  • docker-compose logs -f --tail=500 $service

OpenSSL

  • Debian: apt update && apt-get install python-certbot-nginx

  • CentOS: sudo yum -y install epel-release && sudo yum -y install python-certbot-nginx

  • certbot --nginx -d example.com -d www.example.com

  • docker run --rm -p 443:443 -p 80:80 --name letsencrypt -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" certbot/certbot certonly -n -m "YOUR_EMAIL" -d example.com --standalone --agree-tos

  • cd /etc/nginx/

  • openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/cert.key -out /etc/nginx/ssl/cert.crt

  • openssl genrsa -out /etc/nginx/ssl/ca.key 2048

  • openssl req -new -x509 -key /etc/nginx/ssl/ca.key -out /etc/nginx/ssl/ca.crt

  • openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

  • openssl genrsa -out /etc/nginx/ssl/xprende.key 2048

  • openssl req -new -key /etc/nginx/ssl/xprende.key -out /etc/nginx/ssl/xprende.csr

  • openssl x509 -req -in /etc/nginx/ssl/xprende.csr -CA /etc/nginx/ssl/ca.crt -CAkey /etc/nginx/ssl/ca.key -CAcreateserial -out /etc/nginx/ssl/xprende.crt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment