Child pages
  • nginx setup
Skip to end of metadata
Go to start of metadata

Set up nginx.conf

worker_processes 1;
events {
    worker_connections 1024;
}
http {
    include mime.types;
    default_type application/octet-stream;
    sendfile off;
    keepalive_timeout 15;
    server {
        listen 80;
        server_name yourdomain;

        location /media/ {
            alias /opt/noc/lib/python2.7/site-packages/django/contrib/admin/static/;
            gzip on;
            gzip_types text/css text/x-js;
        }
        location /static/ {
            alias /opt/noc/static/;
            gzip on;
            gzip_types text/css text/x-js;
        }
        location ~ ^/(?!(media|static))([^/]+)/([^/]+)/(js|css|img)/(.+)$ {
            root /opt/noc;
            rewrite ^/([^/]+)/([^/]+)/(js|css|img)/(.+)$
                    /$1/apps/$2/$3/$4 break;
            gzip on;
            gzip_types text/css text/x-js;
        }
        location / {
            proxy_pass http://127.0.0.1:8000/;
            gzip on;
            gzip_types text/css text/x-js;
	        proxy_set_header Host $http_host;
    	    proxy_set_header X-Scheme $scheme;
         }
    }
}