Skip to content

Instantly share code, notes, and snippets.

View AWSomeHackers's full-sized avatar

Wesley zhao AWSomeHackers

View GitHub Profile
@AWSomeHackers
AWSomeHackers / views.py
Created July 31, 2011 08:51
get client ip address in django
def my_view(request):
...
...
client_ip = request.META['REMOTE_ADDR']
#or client_ip = request.META['X_FORWARDED_FOR']
...
@AWSomeHackers
AWSomeHackers / virtual.conf
Created July 31, 2011 08:49
get client ip address in nginx config
#/etc/nginx/sites-available/mysite.com
location / {
#add these next two lines
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param X_FORWADRD_FOR $proxy_add_x_forwarded_for;
#this other stuff was here before
fastcgi_pass 127.0.0.1:8081;
fastcgi_param PATH_INFO $fastcgi_script_name;
@AWSomeHackers
AWSomeHackers / .bashrc
Created July 18, 2011 08:50
creating a new alias in .bashrc
alias aws_ssh='/full/path/to/aws_ssh.sh'
@AWSomeHackers
AWSomeHackers / aws_ssh.sh
Created July 18, 2011 08:42
executable file for ssh in bash
#!/bin/bash
ssh -i /full/path/to/key.pem ubuntu@your.ec2.public.dns.com