Hello,
I'm new to NgniX.
I'm trying to configure NgniX 1.0.5 with SSL & Gzip support (for Magento).
in my server configuration I have added :
# HTTPS server
server {
listen 443 default;
ssl on;
ssl_certificate ssl.crt/wildcard.crt;
ssl_certificate_key ssl.key/wildcard.key;
ssl_session_timeout 10m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
server_name www.xxx.yy *.xxx.yy; ## Domain is here twice so server_name_in_redirect will favour the www
root /home/xxx/www;
index index.php;
gzip on;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 9;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_disable “MSIE [1-6].(?!.*SV1)”;
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
#expires 30d; ## Assume all files are cachable
}
## These locations would be hidden by .htaccess normally
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
# set a nice expire for assets
location ~* "^.+\.(jpe?g|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf)$" {
expires max;
add_header Cache-Control public;
}
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
#autoindex on;
}
location /. { ## Disable .htaccess and other hidden files
return 404;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; ## Do not cache dynamic content
fastcgi_pass unix:/tmp/php-fpm.sock; ## fastcgi_pass 127.0.0.1:9000;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
}
Everything works fine, but there is no GZip compression
With apache : index.php content size (deflated) : 15582 bytes
with NginX : size : 122124 bytes
Can you help me with my configuration ?
What is wrong ?
Does NginX support SSL and Gzip together ?
Something very stange : when I look at the header sent i see the GZIP flag...
$ curl -I --insecure --compressed https://www.xxx.yy/
HTTP/1.1 200 OK
Server: nginx/1.0.5
Date: Sat, 20 Aug 2011 11:12:47 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.3.6
Set-Cookie: frontend=3t1ol6jkaer99utt3rklbshtr0; expires=Sun, 21-Aug-2011 11:12:46 GMT; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Regards,
Eloril