项目结构 Springboot + Html 没有分离 在一个项目里

2019-06-06 10:08:25 +08:00
 571726193

页面正常进,访问接口 404

通过 nginx 代 8066 端口访问 404

   Request URL: http://localhost:8066/black/list?search=&page=1&limit=10
   Request Method: GET
   Status Code: 404 
   Remote Address: 127.0.0.1:8066
   Referrer Policy: no-referrer-when-downgrade

通过 tomcat 访问 200

   Request URL: http://localhost:81/black/list?search=&page=1&limit=10
   Request Method: GET
   Status Code: 200 
   Remote Address: [::1]:81
   Referrer Policy: no-referrer-when-downgrade

nginx.config

upstream serverlist {
    server 127.0.0.1:81 weight=1;
    server 127.0.0.1:83 weight=2;
	server 127.0.0.1:85 weight=3;

}

#gzip  on;

server {
    listen       8066;
    server_name  127.0.0.1;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        #root   \blacklist;
        #index  \black-list.html;
		proxy_pass http://serverlist;
		proxy_redirect default;
        proxy_connect_timeout 1s;
        proxy_read_timeout 5s;
        proxy_send_timeout 2s;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        add_header 'Access-Control-Allow-Headers' 'Content-Type';
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET';

    }

	
	location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|woff)$ {
         proxy_pass http://serverlist;
		 
    }
3017 次点击
所在节点    Java
8 条回复
leeyuzhe
2019-06-06 10:38:02 +08:00
看下 Nginx 日志
LeeSeoung
2019-06-06 10:43:20 +08:00
nginx 只留 location proxy_pass,upstream 里只留 81 端口 一步一步加条件看加了哪个挂了。。
571726193
2019-06-06 13:32:16 +08:00
@leeyuzhe log 里就这个 2019/06/06 09:31:54 [notice] 19756#4324: signal process started
571726193
2019-06-06 13:34:21 +08:00
@LeeSeoung 并没有用 只留一个 proxy_pass 还是 一样的
imycc
2019-06-06 13:41:09 +08:00
nginx 的 access log 看一下 upstream 分配到哪
404 的时候应用有没有收到请求
排查下。再不行就用 tcpflow 监听下这几个端口进来的请求是啥合适的。
kevinWHX
2019-06-06 13:42:06 +08:00
看一下 access.log
571726193
2019-06-06 14:15:03 +08:00
@imycc 127.0.0.1 - - [06/Jun/2019:13:33:49 +0800] "GET /black/list?search=&page=1&limit=10 HTTP/1.1" 404 163 "http://localhost:8066/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36"


这个是咋回事
571726193
2019-06-06 14:24:47 +08:00
@kevinWHX "GET /black/list?search=&page=1&limit=10 HTTP/1.1" 404 163 "http://localhost:8066/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36"



没看出来哪里不对啊

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/571391

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX