Replies: 11 comments 7 replies
-
| Add a routes section matching static files you want and add respective headers in the action for this section as well as specify the directory with share. For example:  | 
Beta Was this translation helpful? Give feedback.
-
| can you help me to convert it to nginx unit conf?  | 
Beta Was this translation helpful? Give feedback.
-
| Sure. Can you tell the reason behind allowing CORS for all origins? Which framework your application is using? | 
Beta Was this translation helpful? Give feedback.
-
| I am using php yii2 framework my actual nginx is working with this nginx.conf! and also i want to add gzip compression but dont find anything in documentation! | 
Beta Was this translation helpful? Give feedback.
-
| You can significantly simplify your configuration if you deal with CORS and gzip compression with the means of your framework. | 
Beta Was this translation helpful? Give feedback.
-
| 
 Currently, NGINX Unit does not support GZIP in production. We are having a beta implementation ready but this didn't find it way into main, yet. For CORS and friends you can use the  Matching for HTTP-Methods is supported. | 
Beta Was this translation helpful? Give feedback.
-
| @rcknr , great answer to the original question! Here's an alternative approach that matches faster (without regex) and simulates NGINX's  [
     {
         "match": {
             "uri": ["*.jpg", "*.jpeg", "*.gif", "*.png", "*.svg", "*.ico", "*.pdf"]
         },
         "action": {
             "share": "/var/www/html/src/frontend/web",
             "response_headers": {
                 "Expires": "`${(() => {var d = new Date(); d.setDate(d.getDate() + 14); return d.toUTCString();} )()}`"
             }
         }
     }
] | 
Beta Was this translation helpful? Give feedback.
-
| @lcrilly Would it work using MIME filtering as well?  | 
Beta Was this translation helpful? Give feedback.
-
| not working blocking just blocking jpg|jpeg|gif|png|svg|ico|pdf|ppt|txt|bmp|rtf|woff|woff2|ttf|eot 404 status not found | 
Beta Was this translation helpful? Give feedback.
-
| 
 Suggest adding router diagnostic logging to your configuration: echo '{"http":{"log_route":true}}' | unitc /config/settings | 
Beta Was this translation helpful? Give feedback.
-
| @chopanovv Make it  | 
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
In nginx i know! i didnot find from documentation!

Beta Was this translation helpful? Give feedback.
All reactions