Postingan

Menampilkan postingan dengan label nginx

Nginx Free TLS certificate

Gambar
Today I learn that there is free TLS Certificate authority we can use to secure our web  Lets Encrypt  and  the tools for registering it  Certbot . To relearn how imporant and how https works in funny comic style visit  https://howhttps.works/ I follow this awesome tutorial to secure my nginx web using certbot  https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04 I cant believe we only need to run this two commands for my running web. sudo snap install --classic certbot sudo certbot --nginx -d your_domain -d your_domain It adjust our nginx sites-enabled config. and even register the cron to extend the certificate expiration automatically.

Nginx Cache

Gambar
 Today I learn nginx feature to cache the web response. Reference :  http://nginx.org/en/docs/http/ngx_http_proxy_module.html several cache config that I think useful are cache size, cache ttl, cache condition & key, cache background update, cache lock / singleflight, and header cache status information. combined it may looks like this  proxy_cache_path /var/cache/adibiarso levels=1:2 keys_zone=adibiarso_cache:10m max_size=200m inactive=10m use_temp_path=off; location / { proxy_cache adibiarso_cache; proxy_cache_key "$request_uri"; proxy_cache_valid 200 404 1m; proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; proxy_cache_background_update on; proxy_cache_lock on;      add_header X-Cache-Status $upstream_cache_status; proxy_pass http://127.0.0.1:5000; } Breakdown proxy_cache_path option to set file cache location, directory level, max size, and inactive state http://nginx.org/en/docs/http/ngx_http_p...