1、整合nginx+tomcat的原理跟nginx+apache一样。nginx是前端代理,把php请求转发到apache,把jsp请求转发到tomcat
nginx+apache:php
nginx+tomcat:jsp
2、配置nginx,进入/usr/local/nginx/conf,增加proxy-pass-jsp.conf,内容为:
location ~ [^/]\.jsp(/|$)
{
proxy_pass http://127.0.0.1:8080;
include proxy.conf;
}
3、进入/usr/local/nginx/conf/vhost,找到对应的域名conf,找到include proxy-pass-php.conf;下面添加:
include proxy-pass-jsp.conf;
4、编辑proxy-pass-php.conf,去掉:
location /
{
try_files $uri @apache;
}
location @apache
{
internal;
proxy_pass http://127.0.0.1:88;
include proxy.conf;
}
5、上面这一步主要为了设置index.jsp为默认页,否则会提示访问错误,<