Nginx WordPress Gzip Virtualhost

admin/ August 26, 2016/ Linux/ 0 comments

The Best and Easy configuration for the WordPress (Gzip Enabled) with nginx.

 

server {
	listen 80 default_server;
	listen [::]:80 default_server;
	listen 443 ssl;
	 root /var/www/html/;
        index index.php index.html index.htm;
	server_name _;
	location / {
			try_files $uri $uri/ /index.php?$args;
		}
	
	 location ~ \.php$ {
				fastcgi_pass unix:/run/php/php7.0-fpm.sock;
				fastcgi_index index.php;
				fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
				fastcgi_param PATH_INFO $fastcgi_path_info;
				include fastcgi_params;
			    }
   gzip on;
   gzip_disable "msie6";
   gzip_comp_level 6;
   gzip_min_length 1100;
   gzip_proxied any;
   gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript
application/json
application/xml
application/xml+rss;

}

Please write comments.

Leave a Reply