Reminance's Studio.

记Thymeleaf Nginx 配置动静分离

字数统计: 117阅读时长: 1 min
2019/07/03 Share

@TOC

[Springboot Thymeleaf]-20190702

记录20190702:

Springboot application.yml配置:

1
2
3
4
5
6
7
8
9
10
  thymeleaf:
prefix: classpath:/templates/
# prefix: http://localhost:80/templates/
# static-locations: http://localhost:80/static/
check-template-location: true
suffix: .html
encoding: UTF-8
content-type: text/html
mode: HTML5
cache: false

Nginx配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
server {
listen 80;
server_name localhost;

#拦截后台请求
location / {
proxy_pass http://localhost:8888;
proxy_set_header X-Real-IP $remote_addr;
}

#拦截静态资源
location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|js|css)$ {
root /**/**/static;
}

}

一天成长多一点~

CATALOG
  1. 1. [Springboot Thymeleaf]-20190702
    1. 1.1. 记录20190702:
      1. 1.1.1. Springboot application.yml配置:
      2. 1.1.2. Nginx配置: