watching nginx server status
Fri, 11/18/2011 - 16:48 — sandipOnce you have turned on nginx stub_status and enabled access from localhost:
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
You can now watch the the status realtime with:
watch -n1 'curl localhost/nginx_status 2>/dev/null'
- sandip's blog
- Login or register to post comments
- Read more
Django HTTPS Redirects
Fri, 03/25/2011 - 15:04 — sandipThis works for both HTTP and HTTPS where any front end web server such as nginx which handles the actual request sets a header when request comes via HTTPS. In Apache configuration you then use mod_setenvif to set the HTTPS variable, which Django then picks up to use for redirection.
With front end nginx server which handles SSL, set header "X-Forwarded-Proto=https" via:
proxy_set_header X-Forwarded-Proto https;
On Apache, add directive:
SetEnvIf X-Forwarded-Proto https HTTPS=1
The HTTPS variable is picked up as being special by mod_wsgi and it will fix the wsgi.url_scheme in WSGI environment which Django then uses for redirection.
This way you don't need to customize Django stack.
- sandip's blog
- Login or register to post comments
- Read more
clear out nginx cache
Wed, 10/13/2010 - 16:15 — sandipIf you are switching out static content that have gotten cached in nginx, the head of the cached files usually stores the file path that can be greped for and the file removed. One you hit the url again, it will recreate the new cached file at the same location.
find /var/cache/nginx -type f -exec grep -l /path/to/oldfile.css {} \;