Skip to content

Instantly share code, notes, and snippets.

View jayanthanantharapu's full-sized avatar
🎯
Focusing

Jayanth Anantharapu jayanthanantharapu

🎯
Focusing
View GitHub Profile
@jayanthanantharapu
jayanthanantharapu / Self signed cert and webserver config
Created May 25, 2024 06:28
Self signed certs and webserver configuration.
# Create dir not exists
mkdir /etc/nginx/ssl
# Certs
openssl genpkey -algorithm RSA -out /etc/nginx/ssl/private.key -aes256
openssl req -new -key /etc/nginx/ssl/private.key -out /etc/nginx/ssl/request.csr
openssl x509 -req -days 365 -in /etc/nginx/ssl/request.csr -signkey /etc/nginx/ssl/private.key -out /etc/nginx/ssl/certificate.crt
# If paraphrase provided, then generate key again
cp /etc/nginx/ssl/private.key /etc/nginx/ssl/private.key.orig
openssl rsa -in /etc/nginx/ssl/private.key.orig -out /etc/nginx/ssl/private.key
@jayanthanantharapu
jayanthanantharapu / django_orm_queries.py
Created October 18, 2022 06:59
Django Orm - print sql queries
from django.db import connection
def print_sql():
indentation = 2
width = 0
for query in connection.queries:
nice_sql = query['sql'].replace('"', '').replace(',',', ')
sql = "\033[1;31m[%s]\033[0m %s" % (query['time'], nice_sql)
message = ""
while len(sql) > width-indentation:
@jayanthanantharapu
jayanthanantharapu / nginxproxy.md
Created August 16, 2016 07:58 — 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