back-end只提供restful的服务。
front-end使用ember。
nginx配置如下:
server {
listen 80;
server_name localhost;
root <front-end app root>;
index index.html index.htm;
# log files
access_log /usr/local/nginx/logs/xxx.access.log;
error_log /usr/local/nginx/logs/xxx.error.log;
## default location ##
location ~ ^.*?/rest/.*$ {
#back-end restful services proxy pass to app server.
proxy_pass http://localhost:8080;
}
location / {
try_files $uri $uri/ /index.html?/$request_uri;
}
}
ember程序等静态资源部署到nginx
rest服务单独部署到web中间件
如此用户间接的通过代理享受着web服务。
web应用分化成了彻头彻尾的两部分。