Enable gzip compression in Nginx

How to enable and test gzip in Nginx. Official document: ngx_http_gzip_module Enable gzip I use Raspberry Pi System Monitor to test gzip module. Modify /etc/nginx/sites-available/default to enable gzip. In this case I only change the RpiMonitor website in the server, you can apply it to global by /etc/nginx/nginx.conf location /rpi { proxy_pass http://127.0.0.1:9999/RpiMonitor; } Change to location /rpi { proxy_pass http://127.0.0.1:9999/RpiMonitor; gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; gzip_proxied any; } Then reload nginx....

May 19, 2017 · 1 min · oopsmonk

Drawing IP Geolocation on World Map

I found some mystery visitors in nginx’s access log. I tried to figure out the location of those visitors and what they did. IP collection First copy nginx’s access log to a folder and save all logs into a single file. $ mkdir mysteryIPs && cd $_ $ sudo cp /var/log/nginx/access.log.* . $ zcat access.log.* > access-gz.log $ cat access.log.1 >> access-gz.log $ cat access.log >> access-gz.log Remove LAN accesses from log file, for example my subnet IP rang is 192....

August 1, 2015 · 4 min · oopsmonk

Nginx Error - 413 Request Entity Too Large

nginx version: nginx/1.1.19, OS: Ubuntu12.04 Default nginx accepted body size limitation is 1MB. You can add client_max_body_size in nginx.conf. This parameter can put in http, server and location sections of configutation file. Enlarge body size to 10MB client_max_body_size 10M Or just disable it client_max_body_size 0 For example enlarge body size to 10MB Add to http section: $ sudo vi /etc/nginx/nginx.conf http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; client_max_body_size 10M; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime....

June 5, 2013 · 1 min · oopsmonk

uWSGI & Nginx on Ubuntu

Install uWSGI Configure uWSGI $ sudo apt-get install python-dev python-pip $ sudo pip uwsgi ################# uWSGI configuration ################# pcre = False kernel = Linux malloc = libc execinfo = False ifaddrs = True ssl = True matheval = False zlib = True locking = pthread_mutex plugin_dir = . timer = timerfd yaml = True json = False filemonitor = inotify routing = False debug = False zeromq = False capabilities = False xml = expat event = epoll ############## end of uWSGI configuration ############# *** uWSGI is ready, launch it with /usr/local/bin/uwsgi *** Successfully installed uwsgi Cleaning up....

May 21, 2013 · 1 min · oopsmonk