Skip to content

Instantly share code, notes, and snippets.

@mekicha
Last active March 12, 2018 09:07
Show Gist options
  • Select an option

  • Save mekicha/d11ae8d63fbdfe76df4e9f4489ef5a3d to your computer and use it in GitHub Desktop.

Select an option

Save mekicha/d11ae8d63fbdfe76df4e9f4489ef5a3d to your computer and use it in GitHub Desktop.
NGINX CONFIGURATION FILE FOR A DJANGO API SERVER, WITH FLOWER-CELERY MONITORING AND RABBITMQ ADMIN INTERFACE ACCESS
server {
    listen 80;
    server_name ip_or_domain_name;
    client_max_body_size 256m;
    location = /favicon.ico { access_log off; log_not_found off; }

    location /static/ {
        alias /path/to/staticfiles/dir;
    }

    location /media/ {
        alias alias /path/to/staticfiles/dir;
    }

    location ~ ^/(api|admin) {
        include proxy_params;
        proxy_pass http://localhost:8000;
    }

    location /flower/ {
	rewrite ^/flower/(.*) /$1 break;
	proxy_pass http://localhost:5555;
	proxy_set_header Host $host;
	proxy_redirect off;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	auth_basic "Restricted";
	auth_basic_user_file /etc/nginx/.htpasswd;
    }
    
	location ~* /rabbitmq/(.*) {                                                                    
                rewrite ^/rabbitmq/(.*)$ /$1 break;                                                     
                proxy_pass http://localhost:15672;                                                      
	}    
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment