apache

apache可以理解为一个非常灵活可配置的高性能web服务框架。

包括最前面处理http请求的MPM可配:perfork, worker, event

包括可动态加载若干第三方动态库,完成插件任务:mod_proxy, mod_ssl, mod_cache, mod_rewrite  ......

包括上层应用通过hook机制,实现自己的请求handler,并通过mod加载机制加载。


高性能体现在:

1、worker采用进程+线程动态可调整的策略,每个请求会被委派到某个空闲进程的某个线程。类似动态可扩展的BIO

      event采用事件驱动模式(epoll),主线程监听socket事件,若干子进程和子线程,执行具体业务逻辑。类似NIO


2、通过mmap完成父子进程的通信


3、通过sendfile处理静态文件,直接在操作系统内核将静态文件从磁盘发送到网络配适层,绕过了内核到用户层在到内核的数据copy


============== install ======================


make distclean && ./configure --prefix=/home/admin/apache --with-mpm=worker --enable-modules=all --enable-ssl --enable-proxy && make && make install

compile all modules as static in default


--enable-modules=all , if not set, some modules like mod_expire will not load

--enable-modules-shared=all, compile all modules as xx.so, and need to LoadModule in config

--enable-ssl, --enable-proxy 需要额外开启

--enable-proxy 会开启全部proxy模块,包括:mod_proxy_ajp, mod_proxy_http, mod_proxy_ftp, mod_proxy_balancer, mod_proxy_scgi


/apache/bin/apachectl -f /home/admin/xx/httpd.conf -t     ( check conf syntax)

/apache/bin/apachectl -l (list all modules)


================= apr =====================

对于httpd-2.4+,需要升级linux下面的apr环境

下载:http://apr.apache.org/download.cgi

# tar -zxvf apr-1.4.2.tar.gz
#cd apr-1.4.2
#./configure --prefix=/usr/local/apr
#make
#sudo make install

#tar -zxvf apr-util-1.3.9.tar.gz

#cd apr-util-1.3.9

#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#sudo make install

下载:http://sourceforge.net/projects/pcre
#unzip -o pcre-8.10.zip
#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#sudo make install



================= rewrite ==================

http://httpd.apache.org/docs/current/mod/mod_rewrite.html


RewriteEngine on

RewriteCond %{REQUEST_URI} !^/images/

RewriteCond %{REQUEST_URI} !^/styles/
RewriteRule ^/8081.html http://10.249.192.168:8081/8081.html [R]   ## means 302 redirect to other server

RewriteRule ^/8081.html http://10.249.192.168:8081/8081.html [P]   ## means forward to other server, need mod_proxy in apache,不支持https的代理


================= mod_proxy ==================

proxy转发后,ip地址变为apache主机的ip,源地址ip存储在request header中: x-forwarded-for = 10.22.9.195

SSLProxyEngine On
ProxyRequests off  ( 停止正向代理)
ProxyPass /images ! (不往此处转发)
ProxyPass /styles !
ProxyPass /scripts !
ProxyPass / https://10.249.192.168:54602/

ProxyPassReverse / https://10.249.192.168:54602/ (必须加,否则在子系统中的redirect跳转地址就不对)

ProxyPass /openapi  https://10.249.192.168:54802/openapi (可以将部分url定向到另一个back server)

ProxyPassReverse /openapi  https://10.249.192.168:54802/openapi


<IfModule worker.c>

     StartServers     10  ( 启动时的httpd进程数)
     MaxClients       1024 (最大并发连接)
     MinSpareThreads  25
     MaxSpareThreads  75
     ThreadsPerChild  64 (每个进程的最大线程数)
     ServerLimit      75 (进程最大数量)
</IfModule>


===================== mod_jk =====================


wget ...tomcat-connectors-1.2.35-src.tar.gz

tar -zxvf tomcat-connectors-1.2.35-src.tar.gz

cd tomcat-connectors-1.2.35-src/native

./configuration --with-apxs=/home/admin/apache/bin/apxs

make

make install

// find mod_jk.so in apache/modules


通过AJP协议和tomcat进行连接,一个apache可以配置映射多个tomcat。ajp协议下,tomcat接收到的ip为源地址ip。

mod_jk.conf配置:

LoadModule jk_module /apsara/alimail/webdeploy/aliyunid/aliyunid_apache_running/modules/mod_jk_for_httpd_2.2.15.so
JkLogFile "|/apsara/alimail/webdeploy/aliyunid/httpd-2.2.15/bin/rotatelogs /apsara/alimail/webdeploy/aliyunid/aliyunid_apache_runnin
g/output/logs/mod_jk.log 86400"


JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardURICompatUnparsed
JkOptions +ForwardDirectories
JkMountCopy All


JkShmFile /apsara/alimail/webdeploy/aliyunid/aliyunid_apache_running/output/logs/jk.shm


JkMount /openapi/* openapi
JkMount /innerapi/* openapi
JkMount /oauth/request_token openapi
JkMount /oauth/access_token openapi


JkMount /* webpage
JkUnMount /images/* webpage
JkUnMount /styles/* webpage
JkUnMount /scripts/* webpage


JkWorkersFile /apsara/alimail/webdeploy/aliyunid/aliyunid_apache_running/conf/workers.properties


workers.properties:

worker.template.type=ajp13
worker.template.socket_timeout=60
worker.template.connect_timeout=60000
worker.template.reply_timeout=60000


worker.list=openapi,webpage


worker.openapi.type=lb # load balancer
worker.openapi.balance_workers=openapi0,openapi1


worker.webpage.type=lb
worker.webpage.balance_workers=webpage0,webpage1


worker.openapi0.port=54990
worker.openapi0.host=10.249.20.48
worker.openapi0.reference=worker.template


worker.openapi1.port=54990
worker.openapi1.host=10.249.26.45
worker.openapi1.reference=worker.template


worker.webpage0.port=54700
worker.webpage0.host=10.249.20.48
worker.webpage0.reference=worker.template


worker.webpage1.port=54700
worker.webpage1.host=10.249.26.45
worker.webpage1.reference=worker.template




tomcat connector配置:

<Connector port="__MY_JBOSS_AJP_PORT__" address="${jboss.bind.address}"
         backlog="256"
         maxThreads="300"
         emptySessionPath="true"
         enableLookups="false"
         connectionTimeout="600000"
         disableUploadTimeout="true"
         protocol="AJP/1.3"
         URIEncoding="UTF-8"

         maxPostSize="6291456" />


转自:http://blog.csdn.net/cnhzgb/article/details/6795144

基于bert实现关系三元组抽取python源码+数据集+项目说明.zip基于bert实现关系三元组抽取python源码+数据集+项目说明.zip基于bert实现关系三元组抽取python源码+数据集+项目说明.zip基于bert实现关系三元组抽取python源码+数据集+项目说明.zip基于bert实现关系三元组抽取python源码+数据集+项目说明.zip 个人大四的毕业设计、课程设计、作业、经导师指导并认可通过的高分设计项目,评审平均分达96.5分。主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。 [资源说明] 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设或者课设、作业,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96.5分,放心下载使用! 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),供学习参考。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值