zoukankan      html  css  js  c++  java
  • 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.

    欢迎指正,交流沟通,共同进步!对您有帮助的话点下推荐~~
  • 相关阅读:
    Python 单向循环链表
    python 单向链表实现
    Python实现栈
    单进程-非阻塞服务器
    Nginx开发从入门到精通
    Spring入门第十五课
    Spring入门第十六课
    Spring入门第十四课
    Spring入门第十三课
    Spring入门第十二课
  • 原文地址:https://www.cnblogs.com/gaoyawei/p/6727911.html
Copyright © 2011-2022 走看看