Skip to content

Instantly share code, notes, and snippets.

@iflamed
Created June 20, 2015 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iflamed/734361cacea27b41c09e to your computer and use it in GitHub Desktop.
Save iflamed/734361cacea27b41c09e to your computer and use it in GitHub Desktop.
Nginx configruation with gzip and cache control
server {
server_name saas.domain.com;
access_log /www/logs/saas.domain.com_access.log;
error_log /www/logs/saas.domain.com_error.log;
root /www/sites/saaspos/public;
index index.php index.html index.htm;
# Begin to gzip config
gzip on;
gzip_min_length 1k;
gzip_comp_level 2;
gzip_types application/javascript application/x-javascript text/css application/xml text/javascript;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
# End of gzip config
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^.+\.(css|js|txt|xml|swf|wav)$ {
access_log off;
expires 24h;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment