Welcome! Log In Create A New Profile

Advanced

Nginx Reverse Proxy SSL / Minification

Posted by frankbasti 
Nginx Reverse Proxy SSL / Minification
July 11, 2012 09:09PM
I am trying to use NginX as a reverse proxy for a few IIS Servers. The goal is to have NginX sit in from of the IIS / Apache servers caching static items such as CSS / JS / Images. I am also trying to get NginX to automatically minify js / css files using its perl module.

I found a sample script for minification here:

http://petermolnar.eu/linux-tech-coding/nginx-perl-minify-css-js/

With the scrip everything works fine, except the reverse proxy breaks.

Questions:

Is what i am trying to accomplish even possible? I want NginX to first minify the scripts before saving them to cache.
Can nginX automtically set the proper expires headers so that static items are cached as long as possible, and only replaced when querystrings are changed (jquery.js?timestamp=march-2012)
Can NginX GZIP the resources before sending them out.
Can NGinx Forward requests or serve up a "Down For Maintenance page" if it cannot connec to back end server.
Any help would be greatly appreciated.


With the above code (perl) installed for minification this is what i have so far:

Here is what i have in my sites-enabled/default so far.

server {


location / {

proxy_pass http://mywebsite.com;
proxy_set_header Host $host;
proxy_cache STATIC;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
}


location @minify {
perl Minify::minify_handler;
}

location ~ \.css$ {
try_files $uri.min.css @minify;
}




location /*.js {
expires 30d;
}



}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 265
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready