我们的网站是nginx+tomcat架构,前端用nginx来处理静态内容,动态的全交给tomcat来处理。之前的SA配置太过于简单,而且没有仔细梳理网站的流程。nginx与tomcat的安装就不说了,很easy,直接贴配置文件,作个笔记
nginx虚拟主机段配置
- server {
- listen 80;
- server_name www.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_redirect off;
- 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主配置文件主要部分
- <Host name="www.jinfeicui.com" appBase="webapps"
- unpackWARs="true" autoDeploy="true"
- xmlValidation="false" xmlNamespaceAware="false">
- <Context path="/" docBase="/var/www/" reloadable="true" debug="0">
- </Context>