您的位置:首页 > 运维架构 > Nginx

linux 安装 nginx

2013-10-10 09:38 316 查看
安装 tcmalloc
1、安装标准库
#wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz 
wget http://192.168.1.150:33333/s/libunwind-1.1.tar.gz tar zxvf libunwind-1.1.tar.gz
cd libunwind-1.1
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install
/sbin/ldconfig
cd ..

2、安装优化库
#wget http://gperftools.googlecode.com/files/gperftools-2.0.tar.gz 
wget http://192.168.1.150:33333/s/gperftools-2.0.tar.gz tar zxvf gperftools-2.0.tar.gz
cd gperftools-2.0
./configure
make
make install
/sbin/ldconfig
cd ..

3、配置库路径
echo "/usr/local/lib" > /etc/ld.so.conf.d/local_lib.conf

/sbin/ldconfig

----------------------

安装nginx
1、编译 pcre
#wget http://downloads.sourceforge.net/project/pcre/pcre/8.31/pcre-8.31.tar.gz 
wget http://192.168.1.150:33333/s/pcre-8.31.tar.gz tar zxvf pcre-8.31.tar.gz
cd pcre-8.31
./configure
make
make install
/sbin/ldconfig
cd ..

2、编译 nginx
1、安装库(可选)
#wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz 
wget http://192.168.1.150:33333/s/GeoIP.tar.gz tar zxvf GeoIP.tar.gz
cd GeoIP-1.4.8
./configure
make
make install
/sbin/ldconfig
cd ..

2、安装
#wget http://nginx.org/download/nginx-1.2.5.tar.gz 
wget http://192.168.1.150:33333/s/nginx-1.2.5.tar.gz tar zxvf nginx-1.2.5.tar.gz
cd nginx-1.2.5
./configure --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-google_perftools_module --with-http_geoip_module --with-pcre=../pcre-8.31
make
make install
/sbin/ldconfig
cd ..

3、创建线程目录
mkdir /tmp/tcmalloc
chmod 0777 /tmp/tcmalloc

--------------

worker_processes  8;
events {
worker_connections  4096;
}
http {
client_max_body_size 128m;

include       mime.types;
default_type  application/octet-stream;
sendfile        on;
keepalive_timeout  65;
server_tokens off;

gzip              on;
gzip_min_length   4096;
gzip_buffers      4 8k;
gzip_types        text/* text/css application/javascript application/x-javascript;
gzip_comp_level   1;
gzip_vary         on;
gzip_http_version 1.1;

server {
listen       8089;
server_name  localhost;
root         /usr/local/tomcat/webapps;
access_log   /dev/null;
error_log    /dev/null;
index        index.jsp;

error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}
location ~ \.(jsp|action|servlet)$ {
proxy_pass   http://192.168.100.252:8087; }
location ~ \.(js|htm|html|jpg|png|gif|css|ico)$
{
expires  1h;
}
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: