错误提示 nginx: [emerg] unknown directive "gzip_static"

 1、检查nginx配置文件错误提示如下:

[root@server nginx]# /applications/nginx/sbin/nginx -t -c /applications/nginx/nginx/nginx.conf
nginx: [emerg] unknown directive "gzip_static" in /applications/nginx/nginx/inc/gzip.conf:4
nginx: configuration file /applications/nginx/nginx/nginx.conf test failed

2、查看nginx的编译参数

[root@server nginx]# /applications/nginx/sbin/nginx -V
nginx version: nginx/1.6.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) 
TLS SNI support enabled
configure arguments: --user=www --group=www --add-module=../ngx_cache_purge-1.3/ --prefix=/applications/nginx-1.6.0 --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module

 3、解决方式,重新编译、安装nginx,增加--with-http_gzip_static_module参数

 
[root@server nginx-1.6.0]# ./configure --user=www --group=www --add-module=../ngx_cache_purge-1.3/ --prefix=/applications/nginx-1.6.0 --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
[root@server nginx-1.6.0]# make && make install

  

 
posted @ 2018-06-06 15:46  MR__Wang  阅读(3241)  评论(0编辑  收藏  举报