Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Apr 25, 2013 12:52 pm 
Offline
Senior Newbie

Joined: Tue Feb 05, 2013 8:01 pm
Posts: 5
Hello everyone,

I can't find a solution on how to enable gzip for css and javascript files for nginx. Html files are gzipped without a problem. Gzip was enabled by default. What could be the reason that html is gzipped but not css or js files? Thank you for your help.
Output from config:

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 2;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##

#include /etc/nginx/naxsi_core.rules;

##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##

#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}


Top
   
PostPosted: Thu Apr 25, 2013 2:37 pm 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
Looking at this, I assume you simply have to uncomment this bit:
Code:
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 2;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;


Top
   
PostPosted: Thu Apr 25, 2013 3:21 pm 
Offline
Senior Newbie

Joined: Tue Feb 05, 2013 8:01 pm
Posts: 5
How do I do that? Remove '#' ? Thanks for the answer.


Top
   
PostPosted: Thu Apr 25, 2013 3:31 pm 
Offline
Senior Newbie

Joined: Tue Feb 05, 2013 8:01 pm
Posts: 5
It's funny how little had to be done and how much time it cost me. Thank you for your help Nuvini, it seems now its all okay. I didn't know that '#' represents comment.


Top
   
PostPosted: Fri Apr 26, 2013 5:54 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
Heh - yep, # represents comments so they won't be used for the actual config.

For future reference, depending on the type of config, comments can also be in ; - // - <!-- --> - -- or in some cases ''


Top
   
PostPosted: Fri Apr 26, 2013 12:30 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
I even sometimes see REM for comments, and not just in batch files or VB :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group