Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mohanpedala
mohanpedala / mac_hidden_files.md
Last active April 15, 2019 19:56
mac show hidden files
  1. In Terminal, paste the following: defaults write com.apple.finder AppleShowAllFiles YES
  2. Press return
  3. Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock and click Relaunch.\

Show/Hide Hidden Files using Terminal Aliases

  1. In Terminal, paste the following: sudo nano ~/.bash_profile or sudo nano ~/.zshrc
  2. Enter your Mac’s administration password if required, then hit return At the bottom of the open .bash_profile file, paste the following:
@mohanpedala
mohanpedala / nginx_logs.md
Created March 26, 2019 18:08
nginx configuring logs

Configuring Logging

  • Documentation For This Video
  • Configure access logs. Two main types are
    • Access logs
    • Error logs
  • According to the above steps we have configured access logs as below.
@mohanpedala
mohanpedala / nginx_improving_ssl_configuration.md
Created March 26, 2019 18:05
nginx improving SSL Configuration

Improving SSL Configuration

  • Documentation:
    • NGINX ssl module
    • Mozilla’s Server Side TLS Documentation
  • Add session caching so that fewer SSL handshakes need to be made.
  • The initial handshake is the most taxing part of the process, and if we can avoid repeating it then we’ll improve our overall performance.
    $ vim /etc/nginx/conf.d/default.conf
    

ssl_certificate /etc/nginx/ssl/public.pem;

@mohanpedala
mohanpedala / nginx_performance_tuning.md
Last active March 25, 2024 06:03
NGINX Performance tuning

NGINX Performance Tuning

Content Compressions and Decompression

  • Documentation
    • NGINX http_gzip module
    • NGINX http_gunzip module
  • Enable gzip. by default, we’re not going to compress the responses that we’re getting from proxied servers or any piece of content that isn’t HTML.
  • But if one of our proxied servers happens to send us a pre-compressed response then we probably want to decompress it for clients that can’t handle gzip. In this situation, we’ll use the gunzip module
    $ vim /etc/nginx/nginx.conf
@mohanpedala
mohanpedala / generate_ssl_certs_automatically.md
Last active December 27, 2023 00:48
Generate SSL Certificates and renewing automatically using Let's Encrypt

Generating SSL Certificates using Let's Encrypt

  • Setup a real domain with an SSL certificate from Let’s Encrypt.
  • Prereq: Own a Domain
  • Documentaion
  • Seting a domain for binarybutter.com. DNS records are as follows
    NAME    TYPE    DATA
    @       A       MY_PUBLIC_IP_ADDRESS
    
@mohanpedala
mohanpedala / sample_nodejs.md
Created March 21, 2019 17:21
Sample nodejs app
Getting the Node.js Application
For this first application, we’re going to be using a multi-application Node.js system that we’ll need to pull from GitHub. The first thing that we need to do is install Node.js itself:

[root] $ curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
[root] $ yum install -y nodejs
Once Node.js is installed, we’re going to clone our repository and run the multiple applications required:

[root] $ mkdir /srv/www/
[root] $ cd /srv/www/
@mohanpedala
mohanpedala / inside_nginx.md
Last active March 28, 2023 12:39
Inside Nginx

Virtual Host and Serving Static Content

  • Default path: vim /etc/nginx/conf.d/default.conf

  • Custom Config vim /etc/nginx/conf.d/example.com.conf

  • Default index.html: /usr/share/nginx/html/index.html

  • Custom index.html: /var/www/example.com/html/index.html

    • Path explanation:
      • Default path : /var/www/
  • Virtualhostname : example.com
@mohanpedala
mohanpedala / daily_docker.md
Last active September 5, 2019 20:17
Daily Docker
  • Set Timezone inside container
    • Create a Dockerfile
    vi Dockerfile
    
    FROM centos:latest
    ENV TZ=America/New_York
    
    # ENTRYPOINT ["ls", "-al"]
    CMD ["/bin/bash"]
    
@mohanpedala
mohanpedala / ssh_agent_forwarding_ansible.md
Created February 2, 2019 19:00
Ansible with SSH Agent Forwarding Tag: Bastion host
  • Create a “config” file that will be used by SSH-agent to do the forwarding of SSH connection.
$ cd .ssh
$ touch config
$ chmod 600 config
$ sudo vi config
SSH-agent forwarding
Host