nginx +tomcat 实现动静分离
nginx 配置如下:
upstream autowebgateway {
server 127.0.0.1:8081;
}
server {
listen 80 default;
listen 443 ssl;
server_name localhost;
ssl_certificate server.pem;
ssl_certificate_key server.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://10.24.39.205:8088; #反代tomcat web服务
}
location /autowebgateway/ { #反代tomcat 动态服务
proxy_pass http://autowebgateway;
#域名+路径访问形式:
location /anliandbc {
root /html;
index index.html;
try_files $uri $uri/ /anliandbc/index.html;
}
#域名+两层路径访问形式:
location /m/cctvfestival {
alias /html/m/cctifestival;
index index.html;
try_files $uri $uri/ /m/cctvfestival/index.html;
}
}
本文转自yzy121403725 51CTO博客,原文链接:http://blog.51cto.com/lookingdream/2045137,如需转载请自行联系原作者