• www.ca88亚洲城.com下载_www.ca88亚洲城.com下载【唯一授权官网】

  • 发布时间:2016-01-13 06:27 | 作者:yc | 来源:互联网 | 浏览:1200 次
  • www.ca88亚洲城.com下载_www.ca88亚洲城.com下载【唯一授权官网】

    必要:nginx处置惩罚用户请求的静态页面,tomcat处置惩罚用户请求jsp页面,来完成动态分袂,nginx处置惩罚静态页面功率远高于tomcat,这么一来就能异常好的进步并发,处置惩罚功能

    预备软件:

    下载jdk1.7:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-.html

    下载tomcat7.0:http://tomcat.apache.org/download-70.cgi

    下载nginx1.6.3:http://nginx.org/en/download.html

    1、JDK设置设备摆设

    [root@web1 ~]# cat /etc/redhat-release

    CentOS release 6.6 (Final)

    [root@web1 ~]# uname -a

    Linux web1 2.6.32-504.el6.i686 #1 SMP Wed Oct 15 03:02:07 UTC 2014 i686 i686 i386 GNU/Linux

    [root@web1 ~]# cd tools

    [root@web1 tools]# tar xf jdk-1.7-linux-32bit.tar.gz -C /usr/local/

    [root@web1 tools]# mv /usr/local/jdk1.7.0_67 /usr/local/jdk

    [root@web1 tools]# vi /etc/profile

    JAVA_HOME=/usr/local/jdk

    PATH=$PATH:$JAVA_HOME/bin

    CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

    export JAVA_HOME PATH CLASSPATH

    [root@web1 tools]# source /etc/profile

    [root@web1 tools]# java -version#显现版别说明成功

    java version "1.7.0_67"

    Java(TM) SE Runtime Environment (build 1.7.0_67-b01)

    Java HotSpot(TM) Client VM (build 24.65-b04, mixed mode)

    2、Tomcat设置设备摆设

    [root@web1 tools]# tar xf apache-tomcat-7.0.64.tar.gz -C /usr/local/

    [root@web1 tools]# mv /usr/local/apache-tomcat-7.0.64 /usr/local/tomcat

    #默许tomcat是root身份运转的,这么不安然,咱们设置来用通俗用户

    [root@web1 tools]# groupadd tomcat

    [root@web1 tools]# userad同升国际官网d -g tomcat tomcat

    [root@web1 tools]# passwd tomcat

    [root@web1 tools]# chown tomcat.tomcat -R /usr/local/tomcat

    [root@web1 tools]# su - tomcat /usr/local/tomcat/bin/startup.sh

    [root@web1 tools]# echo "su - tomcat /usr/local/tomcat/bin/startup.sh" >> /etc/rc.local#开机发动

    [root@web1 tools]# netstat -tunlp|grep java

    tcp00 ::ffff:127.0.0.1:8005:::*LISTEN14940/java

    tcp00 :::8009:::*LISTEN14940/java

    tcp00 :::8080:::*LISTEN14940/java

    3、Nginx装配设置设备摆设

    装配进程详见:http://linuxzkq.blog.51cto.com//

    #主设置设备摆设文件设置设备摆设

    [root@web1 ~]# grep -Ev "#|^$" /application/nginx/conf/nginx.conf

    worker_processes1;

    events {

    worker_connections1024;

    }

    http {

    includemime.types;

    default_typeapplication/octet-stream;

    sendfileon;

    keepalive_timeout65;

    server {

    listen80;

    server_namelocalhost;

    location ~\.(html|htm)$ {

    #jsp网站法度榜样根目录,平日nginx与tomcat在同一个目录

    roothtml;

    indexindex.jsp index.do index.html index.htm;

    }

    location ~\.jsp$ {

    index index.jsp;

    proxy_pass http://127.0.0.1:8080; #来自jsp请求交给tomcat处置惩罚

    proxy_redirect off;

    proxy_set_header Host $host;#后真个Web办事器能够颠末X-Forwarded-For获取用户其实IP

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    client_max_body_size 10m;#准许客户端请求的最大年夜单文件字节数

    client_body_buffer_size 128k; #缓冲区署理缓冲用户端请求pt老虎机平台的最大年夜字节数

    proxy_connect_timeout 90;#nginx跟后端办事器毗连超不时候(署理毗连超时)

    proxy_read_timeout 90;#毗连成功后,后端办事器呼适时候(署理回收超时)

    proxy_buffer_size 4k;#设置署理办事器(nginx)保存用户头信息的缓冲区巨细

    proxy_buffers 6 32k;#proxy_buffers缓冲区,页面匀称在32k以下的话,这么设置

    www.ca88亚洲城.com下载_www.ca88亚洲城.com下载【唯一授权官网】

    proxy_busy_buffers_size 64k;#高负荷下缓冲巨细(proxy_buffers*2)

    proxy_temp_file_write_size 64k;#设定缓存文件夹巨细,大年夜于这个值,将从upstream办事器传

    }

    location ~\.(png|js|css|jpg|gif|xml|svg|ico)$ {#由nginx处置惩罚静态页面

    roothtml/ROOT;

    expires 30d; #运用expires缓存模块,缓存到客户端30天

    }

    }

    }

    650) this.width=650;" title="33333.jpg" style="float:none;" alt="wKioL1YFD13TsONjAAK2ulE9jbU775.jpg" src="/html/uploads/allimg/160113/062A31442-1.jpg" />

    650) this.width=650;" title=".png" style="float:none;" alt="wKiom1YFD1nCGtMXAACmHeHlnuI218.jpg" src="/html/uploads/allimg/160113/062A3NX-2.jpg" />

    这篇文章出自 “兰州linux运维” 博客,请必须保存此出处http://linuxzkq.blog.51cto.com//

  • 相关内容

友情链接: