public
Created

nginx conf

  • Download Gist
nginx.conf
Nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
user www-data www-data;
worker_processes 2;
 
pid /var/run/nginx.pid;
 
events {
worker_connections 1024;
}
 
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
 
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "http_x_forwarded_for"';
 
access_log /var/log/nginx_access.log main;
 
error_log /var/log/nginx_error.log debug;
 
sendfile on;
tcp_nopush on;
tcp_nodelay on;
 
 
server {
listen 80;
server_name www.domain.com;
rewrite ^/(.*) http://domain.com/$1 permanent;
 
}
server {
 
listen 80;
server_name domain.com;
 
access_log /var/log/nginx_access.log main;
error_log /var/log/nginx_error.log debug;
 
# Main location
 
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
# Static files location
location /site_media/ {
root /path/to/site_media;
}
}
}
ports.conf
1 2 3 4 5 6 7 8 9 10 11 12
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
 
# NameVirtualHost *:8000
Listen 8000
 
<IfModule mod_ssl.c>
# SSL name based virtual hosts are not yet supported, therefore no
# NameVirtualHost statement here
Listen 443
</IfModule>
project.wsgi
Python
1 2 3 4 5 6 7 8 9 10 11
import os, sys
 
sys.stdout = sys.stderr
 
sys.path.append('/home/user')
sys.path.append('/home/user/project')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
 
import django.core.handlers.wsgi
 
application = django.core.handlers.wsgi.WSGIHandler()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.