All posts tagged: nginx

Nginx configuration for Django

Leave a comment
Howtos / System Administration

Django is a powerful framework for building websites. To run a production website, usually an application server is used. So nginx will do two basic things: Serve your Django application from the application server port to the web port (Reverse Proxy) Serve static and media files The application server used in this example is gunicorn, the application server chosen by Instagram of the earlier days, but it can be anything running on port 9999. Change […]

nginx: [emerg] open() “/usr/share/nginx/off” failed (13: Permission denied) [SOLVED]

Leave a comment
Howtos / System Administration

After a failed restart of the nginx server, you can get this error typing journalctl -xe: nginx: [emerg] open() “/usr/share/nginx/off” failed (13: Permission denied) [SOLVED] This is caused by a misconfiguration of nginx.conf or a conf inside the /etc/nginx/conf.d/ directory where there’s something like: This is the wrong way to disable logs. Nginx is actually trying to write a file called off inside the default folder. The right way To disable error_log simply do not […]

Free SSL certificates and how to install on nginx in 10 steps

comment 1
Howtos / System Administration
HTTPS, encrypt via SSL / TLS

Here how you can get free SSL cerificates using Let’s Encrypt. Forget about the expire of certificates using the auto-renewal script. A complete reference to install a Let’s Encrypt certificate is this Digital Ocean’s howto. Here there’s a quick guide based on it, plus some additional suggestions. Here we go! The following code download the script and make it executable. (1) Logout and login again to make the certbot-auto script available as a command without […]

How to enable gzip on proxy servers on nginx

Leave a comment
Howtos / System Administration

I use often Gunicorn as web server for django applications. Usually I use Apache but I’m starting to use nginx as webserver to serve both the static files and the proxied gunicorn response. I need to do something like what I’ve done with Apache to compress the response after I received from django since I’ve noticed that in my case compressing it before using @gzip_page decorator is more detrimental to performance than doing it after. […]