Created
June 20, 2015 05:20
-
-
Save iflamed/734361cacea27b41c09e to your computer and use it in GitHub Desktop.
Nginx configruation with gzip and cache control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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