首页 > 技术文章 > nginx安装

linux-ng 2019-02-14 15:21 原文

前提

yum install pcre*

yum install openssl*

yum install openssl openssl-devel

yum -y install automake autoconf libtool make

yum install gcc gcc-c++

yum -y install net-tools

yum install -y zlib zlib-devel

 

编译

./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-http_gzip_static_module

make & make install

 

在/usr/local/nginx/conf里,编辑nginx.conf文件,添加以下这段话:

gzip  on;

gzip_static on;

gzip_comp_level 2;

gzip_http_version 1.0;

gzip_proxied any;

gzip_min_length 1100;

gzip_buffers 16 8k;

gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;

# Disable for IE < 6 because there are some known problems

gzip_disable "MSIE [1-6].(?!.*SV1)";

# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6

gzip_vary on;

 

启动

/usr/local/nginx/sbin/nginx

 验证

curl -s http://localhost |grep nginx.com

重启

/usr/local/nginx/sbin/nginx -s reload

 


  

 

 

推荐阅读