nginx配置tomcat与配置rewrite。
来源:互联网 发布:plc梯形图编程规则 编辑:程序博客网 时间:2024/06/06 00:23
tomcat的server.xml文件下可以配置<Context path > docBase 配置项目的访问路径,这样可以直接访问tomcat的端口不用加项目名称来访问项目。
<Context path="" docBase="/usr/project/XYD" reloadable="true">
</Context>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/usr/project/XYD" reloadable="true">
</Context>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
</Host>
nginx proxy_pass实现项目upstream负载:
upstream hostname{
server 127.0.0.1:8080 max_fails=0 weight=1;
server 127.0.0.1:8090 max_fails=0 weight=1;
server 192.168.5.82:8080 max_fails=0 weight=1;
}
server {
listen 80;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://hostname;
proxy_set_header X-Real-IP $remote_addr;
#root /usr/share/nginx/html;
#index index.html index.htm;
# example
#ModSecurityEnabled on;
#ModSecurityConfig /etc/nginx/modsecurity.conf;
#rewrite ^/ http://192.168.5.31:8080/XYD;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
----rewrite的解释
#rewrite ^/ http://192.168.5.31:8080/XYD; 配置后 访问 localhost后项目直接跳转到相应的域名项目目录。
- nginx配置tomcat与配置rewrite。
- nginx rewrite 配置说明与参数详解
- NGINX的REWRITE配置
- nginx 配置 rewrite 跳转
- nginx rewrite配置
- nginx rewrite 配置
- nginx 配置说明 rewrite
- nginx rewrite 配置实例
- Nginx的Rewrite配置
- nginx配置ThinkPHP Rewrite
- Nginx的Rewrite配置
- Nginx rewrite配置规则
- Nginx配置基础-rewrite
- Nginx之rewrite配置
- nginx配置rewrite实例【转】
- 配置nginx服务器的rewrite
- Nginx rewrite 配置问号解决办法
- Nginx的Rewrite的配置
- Linux面试题汇总答案
- 将博客搬至51CTO
- maven框架开发springmvc+spring+mybatis
- Apache的配置技巧
- JdbcTemplate + sqlserver 2005 分页+Extjs
- nginx配置tomcat与配置rewrite。
- 机器学习中的数学(5)-强大的矩阵奇异值分解(SVD)及其应用
- Android取消标题栏&强制设置横(竖)屏方法
- 动态数组的模板类/求指定个数的素数
- 黑马程序员----面象对象及封装
- android学习笔记(二)布局
- AlphaAnimation无效
- ethercat Mark一下,后续在写
- 回顾系列2-部落战争