zoukankan      html  css  js  c++  java
  • 如何在tomcat前部署一个nginx

    在tomcat应用已经发布后,如何在tomcat前部署一个nginx,可以正常访问jsp,静态资源(html,css,js)

     这里tomcat的端口号是8888

     1 upstream   morris {
     2     server  127.0.0.1:8888;
     3 }
     4 
     5 
     6 server {
     7     listen        80;
     8     server_name   tooth.xxxx.com;
     9     root          /usr/share/nginx/html;
    10 
    11     # Load configuration files for the default server block.
    12     include /etc/nginx/default.d/*.conf;
    13 
    14     #都没有匹配就走这个映射
    15     location / {
    16         proxy_pass  http://morris;
    17     }
    18 
    19     
    20     #location /tooth_resoure/  {
    21     #    root /mydata/toothapp;
    22     #}
    23     
    24     #这里是对jsp的转发
    25     location ~ .(jsp|jspx|do|action)?$ 
    26         {   
    27             #=============tomcat的资源位置============
    28             root  /mydata/toothapp/tooth_resoure;
    29             index index.jsp index.jspx index.do;
    30             #==========Nginx提供的代理============
    31             proxy_set_header X-Forwarded-Host $host;
    32             proxy_set_header X-Forwarded-Server $host;
    33             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    34             #=== 如果遇到.jsp .jspx .do .action 的请求就进入该服务器(tomcat)===
    35             proxy_pass   http://127.0.0.1:8888;
    36     }
    37     
    38     #这里是对静态资源的转发,ip地址写服务器的真实地址
    39     location ~ .*.(html|htm|ico|png|jpg|jpeg|js|css|bmp)$ {
    40          proxy_pass   http://xx.xx.xx.xx:8888;
    41     }
    42     
    43     
    44 }

    参考: https://www.cnblogs.com/jalja/p/6117523.html 

                https://blog.csdn.net/cxm19881208/article/details/65441865

  • 相关阅读:
    Real-Time SQL Monitoring
    MySQL数据复制的校验
    Mysql复制-Slave库设置复制延迟
    MySQL Replication的相关文件
    mysql 启动和关闭外键约束
    mysql写注释的几种方法
    salt更换新key
    saltstack之syndic的配置
    salt-ssh的批量脚本及使用方法
    koan重装system
  • 原文地址:https://www.cnblogs.com/moris5013/p/9796917.html
Copyright © 2011-2022 走看看