nginx与tomcat结合,动静分离
我们的网站是nginx+tomcat架构,前端用nginx来处理静态内容,动态的全交给tomcat来处理。之前的SA配置太过于简单,而且没有仔细梳理网站的流程。nginx与tomcat的安装就不说了,很easy,直接贴配置文件,作个笔记nginx虚拟主机段配置
[*]server {
[*] listen 80;
[*] server_namewww.xxxx.com 192.168.8.62;
[*] index index.html index.htm index.action;
[*] root /var/www/;
[*]
[*] if ($document_uri ~* "\.xhtml$") {
[*] rewrite ^/(.*).xhtml$ /$1.action last;
[*] }
[*]
[*] location ~* \.(action|svl)?$ {
[*] include proxy.conf;
[*] proxy_redirectoff;
[*] proxy_pass http://127.0.0.1:8080;
[*] }
[*]
[*] location ~ (favicon.ico) {
[*] log_not_found off;
[*] expires max;
[*] }
[*]
[*] location ~* ^/(WEB-INF)/ {
[*] deny all;
[*] }
[*]
[*] location /nginx_status {
[*] stub_status on;
[*] #auth_basic "nginx status";
[*] #auth_basic_user_file /usr/local/apache/htdocs/.htpasswd;
[*] access_log off;
[*] allow 192.168.8.253;
[*] allow 127.0.0.1;
[*] deny all;
[*] }
[*]
[*]}
tomcat主配置文件主要部分
[*]
[*]
[*]
[*]
页:
[1]