zoukankan      html  css  js  c++  java
  • centos7 搭建nginx和tomcat集成

    一.安装jdk

    1.yum install jdk

    2.安装好了之后配置环境变量  在/etc/profile 

    二.创建项目运行目录

     1. 我放在home目录  mkdir /web/webapps

    三.安装tomcat

    1.下载tomcat

    2.解压后,修改conf里面server.xml  

    <Host name="localhost" appBase="/home/web/webapps" deployOnStartup ="false"
    unpackWARs="true" autoDeploy="true">

    红色部分为修改 将appBase修改为项目放置路径 添加deployOnStartup ="false"

    四.编译安装nginx

     1.下载nginx源码

     2. 解压源码  执行 ./configure --prefix=/usr/local/nginx 

           make & make install

    五.修改nginx.conf

        在nginx /conf/nginx.conf   

         //分发地址tomcat

      upstream tomcat_testweb{
        server localhost:8080 weight=10;
      }

      server {
        listen 80;
        server_name 120.76.115.208;  //修改为服务器ip或域名
        root /home/web/webapps;        //修改为项目放置路径
        index index.jsp index.html index.htm;

        #charset koi8-r;

        #access_log logs/host.access.log main;
        location / {
        proxy_next_upstream http_502 http_504 error timeout invalid_header;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://tomcat_testweb;        //使用分发地址
        expires 3d;
      }

        

  • 相关阅读:
    Warning: 执行完毕, 但带有警告 trigger trigger_EqPic_insert 已编译。
    c#生成cad缩略图或者图片
    ORACLE ROWNUM解析[转]
    集合已修改;可能无法执行枚举操作。
    JS 变量是否有值的判断
    简单方法解决bootstrap3 modal异步加载只一次的问题
    System.Data.DbType映射关系
    sql zhuan ORACLE
    Enterprise Library
    sql server转oracle需要注意的几点
  • 原文地址:https://www.cnblogs.com/John5/p/5356633.html
Copyright © 2011-2022 走看看