Skip to content

Instantly share code, notes, and snippets.

@SalahAdDin
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SalahAdDin/a1fad7b8cf90b8bac0a3 to your computer and use it in GitHub Desktop.
Save SalahAdDin/a1fad7b8cf90b8bac0a3 to your computer and use it in GitHub Desktop.
Configuración para nginx
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "tiempoturco", "statics", "media")
#STATIC_ROOT = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2] + ['statics/static_only'])
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "tiempoturco", "statics", "static_only", )
#STATICFILES_DIRS = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2] + ['statics/static'])
STATICFILES_DIRS = (os.path.join(os.path.dirname(BASE_DIR), "tiempoturco", "statics", "static"),)
upstream tiempoturco {
least_conn; #Balanceo por numero de conexiones activas y pesos en nodos
#server unix:/tmp/gunicorn.sock fail_timeout=0;
server 192.168.56.1:8001 weight=5 max_fails=5 fail_timeout=30s;
server 192.168.56.2 weight=2; #Nodo 1
server 192.168.56.3 weight=4; #Nodo 2
server 192.168.56.4 backup; #Nodo 3 Respaldo
#server 192.0.0.1 weight=5 max_fails=5 fail_timeout=30s; #Balanceador
#sticky learn
# create=$upstream_cookie_sessionid
# lookup=$cookie_sessionid
# zone=client_sessions:1m
# timeout=1h;
}
server{
listen 8000;
server_name localhost;
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 300M;
sendfile on;
send_timeout 300s;
access_log /var/log/nginx/tiempoturco/acces.log;
error_log /var/log/nginx/tiempoturco/error.log;
location /static/ {
alias /home/tulipan/Proyectos/Noticias/tiempoturco/statics/static/;
}
location /media/ {
alias /home/tulipan/Proyectos/Noticias/tiempoturco/statics/media/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename){
proxy_pass http://tiempoturco;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /home/tulipan/Proyectos/Noticias/tiempoturco/statics/templates;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment