If there a way to set Global Expires Headers for all domains on an Nginx install?Setting expires headers for...

Can a space-faring robot still function over a billion years?

Why can't we use freedom of speech and expression to incite people to rebel against government in India?

Paper published similar to PhD thesis

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

Gemara word for QED

Problems with rounding giving too many digits

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

How spaceships determine each other's mass in space?

Is every open circuit a capacitor?

Can inspiration allow the Rogue to make a Sneak Attack?

Is being socially reclusive okay for a graduate student?

An Undercover Army

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Where do you go through passport control when transiting through another Schengen airport on your way out of the Schengen area?

Is divide-by-zero a security vulnerability?

I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?

Is there a way to find out the age of climbing ropes?

What is the purpose of a disclaimer like "this is not legal advice"?

3.5% Interest Student Loan or use all of my savings on Tuition?

The (Easy) Road to Code

Affine transformation of circular arc in 3D

Integrating function with /; in its definition

How can I be pwned if I'm not registered on the compromised site?

What is the oldest European royal house?



If there a way to set Global Expires Headers for all domains on an Nginx install?


Setting expires headers for static content served from nginxHelp needed setting up nginx to serve static filesBlank Page: wordpress on nginx+php-fpmConfigure php5-fpm for many concurrent usersNginx gives 504 Gateway Time-out once moved to liveNginx Cache-ControlPHP app breaks on Nginx, but works on ApacheApache / Nginx / Varnish - GZIP does not work on css, jsnginx rewrite throw 404 with last and breakNGINX virtual host config for Magento2 in a subfolder













0















New to nginx. I searched for this but was unable to find what I was looking for, maybe I'm thinking of it wrong.



Is there a way to add the following rules to an nginx conf somewhere which will apply to any new domains added to the install w/o having to add the rules to each new domain's conf?



# cache.appcache, your document html and data
location ~* .(?:manifest|appcache|html|xml|json)$ {
expires -1;
# access_log logs/static.log;
}

# Feed
location ~* .(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}

# Favicon
location ~* .ico$ {
expires 1w;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}

# Media: images, video, audio, HTC, WebFonts
location ~* .(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
expires 1M;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}

location ~* .(js|css)$ {
expires 60d;
add_header Pragma public;
add_header Cache-Control "public";
}

# CSS and Javascript
location ~* .(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}

# opt-in to the future
add_header "X-UA-Compatible" "IE=Edge,chrome=1";


Thanks.










share|improve this question














bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    New to nginx. I searched for this but was unable to find what I was looking for, maybe I'm thinking of it wrong.



    Is there a way to add the following rules to an nginx conf somewhere which will apply to any new domains added to the install w/o having to add the rules to each new domain's conf?



    # cache.appcache, your document html and data
    location ~* .(?:manifest|appcache|html|xml|json)$ {
    expires -1;
    # access_log logs/static.log;
    }

    # Feed
    location ~* .(?:rss|atom)$ {
    expires 1h;
    add_header Cache-Control "public";
    }

    # Favicon
    location ~* .ico$ {
    expires 1w;
    access_log off;
    add_header Pragma public;
    add_header Cache-Control "public";
    }

    # Media: images, video, audio, HTC, WebFonts
    location ~* .(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
    expires 1M;
    access_log off;
    add_header Pragma public;
    add_header Cache-Control "public";
    }

    location ~* .(js|css)$ {
    expires 60d;
    add_header Pragma public;
    add_header Cache-Control "public";
    }

    # CSS and Javascript
    location ~* .(?:css|js)$ {
    expires 1y;
    access_log off;
    add_header Cache-Control "public";
    }

    # opt-in to the future
    add_header "X-UA-Compatible" "IE=Edge,chrome=1";


    Thanks.










    share|improve this question














    bumped to the homepage by Community 13 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      New to nginx. I searched for this but was unable to find what I was looking for, maybe I'm thinking of it wrong.



      Is there a way to add the following rules to an nginx conf somewhere which will apply to any new domains added to the install w/o having to add the rules to each new domain's conf?



      # cache.appcache, your document html and data
      location ~* .(?:manifest|appcache|html|xml|json)$ {
      expires -1;
      # access_log logs/static.log;
      }

      # Feed
      location ~* .(?:rss|atom)$ {
      expires 1h;
      add_header Cache-Control "public";
      }

      # Favicon
      location ~* .ico$ {
      expires 1w;
      access_log off;
      add_header Pragma public;
      add_header Cache-Control "public";
      }

      # Media: images, video, audio, HTC, WebFonts
      location ~* .(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
      expires 1M;
      access_log off;
      add_header Pragma public;
      add_header Cache-Control "public";
      }

      location ~* .(js|css)$ {
      expires 60d;
      add_header Pragma public;
      add_header Cache-Control "public";
      }

      # CSS and Javascript
      location ~* .(?:css|js)$ {
      expires 1y;
      access_log off;
      add_header Cache-Control "public";
      }

      # opt-in to the future
      add_header "X-UA-Compatible" "IE=Edge,chrome=1";


      Thanks.










      share|improve this question














      New to nginx. I searched for this but was unable to find what I was looking for, maybe I'm thinking of it wrong.



      Is there a way to add the following rules to an nginx conf somewhere which will apply to any new domains added to the install w/o having to add the rules to each new domain's conf?



      # cache.appcache, your document html and data
      location ~* .(?:manifest|appcache|html|xml|json)$ {
      expires -1;
      # access_log logs/static.log;
      }

      # Feed
      location ~* .(?:rss|atom)$ {
      expires 1h;
      add_header Cache-Control "public";
      }

      # Favicon
      location ~* .ico$ {
      expires 1w;
      access_log off;
      add_header Pragma public;
      add_header Cache-Control "public";
      }

      # Media: images, video, audio, HTC, WebFonts
      location ~* .(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
      expires 1M;
      access_log off;
      add_header Pragma public;
      add_header Cache-Control "public";
      }

      location ~* .(js|css)$ {
      expires 60d;
      add_header Pragma public;
      add_header Cache-Control "public";
      }

      # CSS and Javascript
      location ~* .(?:css|js)$ {
      expires 1y;
      access_log off;
      add_header Cache-Control "public";
      }

      # opt-in to the future
      add_header "X-UA-Compatible" "IE=Edge,chrome=1";


      Thanks.







      nginx conf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '15 at 18:41









      Steve AdamsSteve Adams

      1012




      1012





      bumped to the homepage by Community 13 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 13 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Put the configuration you posted here into an separate file (e.g. /etc/nginx/conf.d/expires.global) and then include that file in your virtualhosts using include directive.



          server {
          ...
          include /etc/nginx/conf.d/expires.global;
          }





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "2"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f738416%2fif-there-a-way-to-set-global-expires-headers-for-all-domains-on-an-nginx-install%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Put the configuration you posted here into an separate file (e.g. /etc/nginx/conf.d/expires.global) and then include that file in your virtualhosts using include directive.



            server {
            ...
            include /etc/nginx/conf.d/expires.global;
            }





            share|improve this answer




























              0














              Put the configuration you posted here into an separate file (e.g. /etc/nginx/conf.d/expires.global) and then include that file in your virtualhosts using include directive.



              server {
              ...
              include /etc/nginx/conf.d/expires.global;
              }





              share|improve this answer


























                0












                0








                0







                Put the configuration you posted here into an separate file (e.g. /etc/nginx/conf.d/expires.global) and then include that file in your virtualhosts using include directive.



                server {
                ...
                include /etc/nginx/conf.d/expires.global;
                }





                share|improve this answer













                Put the configuration you posted here into an separate file (e.g. /etc/nginx/conf.d/expires.global) and then include that file in your virtualhosts using include directive.



                server {
                ...
                include /etc/nginx/conf.d/expires.global;
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 23 '15 at 19:18









                TubelessTubeless

                894711




                894711






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Server Fault!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f738416%2fif-there-a-way-to-set-global-expires-headers-for-all-domains-on-an-nginx-install%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

                    Список ссавців Італії Природоохоронні статуси | Список |...

                    Українські прізвища Зміст Історичні відомості |...