nginx代理后刷新显示404
1
server {
2 listen 1554;
3 server_name 114.115.170.119;
4
5
6 location / {
7 root "/data/tzjk/front";
8 index index.html index.htm;
9 try_files $uri $uri/ /index.html;
10 }
11 location /health/{
12 #proxy_pass http://192.168.100.31:8086/tr/;
13 proxy_pass http://114.115.170.119:1553/health/;
14 }
15 location /dmm_cas/ {
16 proxy_pass http://114.115.170.119:1550/dmm_cas/;
17 }
18 error_page 500 502 503 504 /50x.html;
19 location = /50x.html {
20 root html;
21 }
22 }
23
24
在配置中加上try_files,意思跟翻译差不多,“尝试读取文件”。uri这个是nginx的一个变量,存放着用户访问的地址,例如
http://localhost:8200/chooseSize那么 uri 这个是nginx的一个变量,存放着用户访问的地址,例如
http://localhost:8200/chooseSize 那么uri这个是nginx的一个变量,存放着用户访问的地址,例如
http://localhost:8200/chooseSize那么uri就是/chooseSize;uri/代表访问的是一个目录例如
http://localhost:8200/chooseSize/那么 uri/ 代表访问的是一个目录 例如http://localhost:8200/chooseSize/ 那么uri/代表访
问的是一个目录例如http://localhost:8200/chooseSize/那么uri/就是/chooseSize/;最后/index.html就是我们首页的地
址。