Nginx Reverse Proxy SSL / Minification
Nginx is the ideal solution for reverse-proxy, it's also Unix way "do one thing and do it well". So I'd advice you to split content serve and minification process out instead of using third-party plugins to do many things at once.
Best practice is to do minify&obfuscate phase on local system before you do a deployment on production, this is easy to say and not hard to do, see the google way to compress static assets. Once you got assets ready-to-use, we can setup nginx configuration.
Answers:
use minify&obfuscate before deploy it on production
you can find assets by regexp (directory name or file extension)
location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ { gzip_static on; expires max; add_header Cache-Control public; add_header Last-Modified ""; add_header ETag ""; break;}
use gzip on and gzip_static on to serve gzipped files instead of compress it every time when request is coming.
use try_files to detect the maintenance page exists or not
try_files $uri /system/maintenance.html @mywebsite;
if (-f $document_root/system/maintenance.html) { return 503;}
See the full nginx config for your case:
http { keepalive_timeout 70; gzip on; gzip_http_version 1.1; gzip_disable "msie6"; gzip_vary on; gzip_min_length 1100; gzip_buffers 64 8k; gzip_comp_level 3; gzip_proxied any; gzip_types text/plain text/css application/x-javascript text/xml application/xml; upstream mywebsite { server 192.168.0.1 # change it with your setting } server { try_files $uri /system/maintenance.html @mywebsite; location @mywebsite { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://mywebsite; } location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ { gzip_static on; expires max; add_header Cache-Control public; add_header Last-Modified ""; add_header ETag ""; break; } if (-f $document_root/system/maintenance.html) { return 503; } location @503 { error_page 405 = /system/maintenance.html; if (-f $document_root/system/maintenance.html) { rewrite ^(.*)$ /system/maintenance.html break; } rewrite ^(.*)$ /503.html break; } }}