1

I ve a web app built with Angular (angular-cli)

To build my app , i am running ng build --configuration=production

I ve been todl that gzipping action was removed from this process from angular-cli , So using a specific npm package "Gzipper" : https://www.npmjs.com/package/gzipper

I was used to both build and compress my outputed files using one combinated command :

ng build --configuration=production && && gzipper src/main/webapp/dist --log

my output file are like this :

  • scriptOne.js
  • scriptOne.js.gzip
  • scriptTwo.js
  • scriptTwo.js.gzip
  • myStyle.css
  • myStyle.css.gzip

Now under my nginx.conf.file : i ve put this config :

http {
    include mime.types;
    default_type  application/octet-stream;
    client_max_body_size 10M;

    sendfile        on;
    keepalive_timeout  65;

    more_clear_headers "Server";

    gzip  on;
    gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;

    server {
       ...
    }

Even with all this : under any browser , it throws me a 404 not found files Seems that it can't see those gzip files and my app cannot be served

Suggestions ?

1 Answer 1

3

You have to add gzip_static on;

gzip  on;
gzip_static on;

The ngx_http_gzip_static_module module allows sending precompressed files with the “.gz” filename extension instead of regular files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.