Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8218183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:42:14+00:00 2026-06-07T12:42:14+00:00

I am trying to use NginX as a reverse proxy for a few IIS

  • 0

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:

  1. Is what i am trying to accomplish even possible? I want NginX to first minify the scripts before saving them to cache.
  2. 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)
  3. Can NginX GZIP the resources before sending them out.
  4. 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.

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;
            }



}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:42:16+00:00Added an answer on June 7, 2026 at 12:42 pm

    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:

    1. use minify&obfuscate before deploy it on production

    2. 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;
      }

    3. use gzip on and gzip_static on to serve gzipped files instead of compress it every time when request is coming.

    4. 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;
        }
    
      }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Varnish as a reverse caching proxy for my nginx
I have been trying to setup nginx with passenger for a few days now
I'm trying to use the map of nginx, but the results aren't what I
I'm trying to use the varnish caching with symfony2. Setup is Varnish -> NGNIX
I am trying use gem tire to search in my application. I have tables
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Hi I'm trying use a datepicker on a field I have. I'm trying to
I am trying use std::copy to copy from two different iterator. But during course
I have an application running on thin 1.2.11 behind nginx. I was trying to
i'm trying use webview to load a image from sdcard i use this path

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.