錯誤提示 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

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM