linux下安装nginx
下载nginx: wget http://nginx.org/download/nginx-1.8.0.tar.gz
下载openssl : wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz
下载zlib : wget http://zlib.net/zlib-1.2.8.tar.gz
下载pcre : wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
http://pan.baidu.com/s/1qXZdvm0 //百度网盘 后俩个网址出错请网盘下载上传
----------------------------------------------------
分别编译安装
[root@localhost] tar zxvf openssl-fips-2.0.9.tar.gz
[root@localhost] cd openssl-fips-2.0.9
[root@localhost] ./config && make && make install
----------------------------------------------------
[root@localhost] tar zxvf pcre-8.36.tar.gz
[root@localhost] cd pcre-8.36
[root@localhost] ./configure && make && make install
----------------------------------------------------
[root@localhost]tar zxvf zlib-1.2.8.tar.gz
[root@localhost] cd zlib-1.2.8
[root@localhost] ./configure && make && make install
----------------------------------------------------
[root@localhost]tar zxvf nginx-1.8.0.tar.gz
[root@localhost] cd nginx-1.8.0
[root@localhost] ./configure && make && make install
----------------------------------------------------
启动nginx
[root@localhost] ./usr/local/nginx/sbin/nginx
----------------------------------------------------
简单测试nginx 在本机启动多个个tomcat
配置nginx配置文件
[root@localhost] vi nginx.conf
upstream mysvr{
#tomcat1加权轮询 server 127.0.0.1:8080 weight=1;
#tomcat2 server 127.0.0.1:8081 weight=2; } #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 7979; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm;
#请求转向mysvr 定义的服务器列表 proxy_pass http://mysvr; }
#nginx配置其他配置可参考http://www.cnblogs.com/knowledgesea/p/5199046.html
#同时启动俩个tomcat自行百度。为了测试nginx代理可将俩个tomcat首页更改,以便区别是哪个tomcat.