nginx 跨域。。。掉坑里了,小心
今天公司產(chǎn)品一個功能突然掛掉了。。。向客戶演示之前出現(xiàn)了,手機(jī)端顯示不能獲取下載資源,可是急壞了一票人。。
通過手機(jī)端,調(diào)查服務(wù)器地址調(diào)用了http:/2342342.domain.hostname.cn/apis/stickydataurls/接口,服務(wù)器返回502和500錯誤,去查看服務(wù)器前端Nginx錯誤日志顯示:
2014/08/13 16:11:00 [error] 23851#0: *10303771 connect() failed (111: Connection refused) while connecting to upstream, client: 12.12.12.12, server: *.domain.hostname.cn, request: "POST /apis/pl/getStickGoInfo HTTP/1.0", upstream: "http://10.8.1.10:8080/apis/pl/getStickGoInfo", host: "00e06f26db47.domain.hostname.cn".........................
2014/08/13 16:21:48 [error] 24149#0: *9354 invalid URL prefix in "http://", client: 14.205.27.34, server: *.domain.hostname.cn, request: "GET / HTTP/1.1", host: "123456789012.domain.hostname.cn" 2014/08/13 16:21:49 [error] 24149#0: *9363 invalid URL prefix in "http://", client: 14.205.27.34, server: *.domain.hostname.cn, request: "GET / HTTP/1.1", host: "123456789012.domain.hostname.cn", request: "GET /favicon.ico HTTP/1.1", host: "123456789012.domain.hostname.cn" 2014/08/13 16:21:49 [error] 24149#0: *9365 invalid URL prefix in "http://", client: 14.205.27.34, server: *.domain.hostname.cn, request: "GET / HTTP/1.1", host: "123456789012.s.234g.cn", request: "GET /favicon.ico HTTP/1.1", host: "123456789012.domain.hostname.cn" 2014/08/13 16:25:32 [error] 24151#0: *12008 directory index of "/var/www/" is forbidden, client: 36.103.170.240, server: host, request: "GET / HTTP/1.0", host: host
這個時候再去看Nginx配置,也沒有錯。對于路徑/? 和/apis/stickydataurls/都有重定向,
server_name *.domain.hostname.cn; location /{................ } location = /apis/stickydataurls/ {include /etc/nginx/conf.d/PhyLink;proxy_pass http://do.host.cn/apis/pl/getStickGoInfo; }但是訪問一直出現(xiàn)問題。
再去查看日志,發(fā)現(xiàn)最早的日志,出現(xiàn)了不應(yīng)該出現(xiàn)的8080端口,這個端口是在 location / 分支才應(yīng)該出現(xiàn)的,但是在這個配置里邊,出現(xiàn)這個情況是完全不能理解的,手機(jī)端調(diào)用/apis/stickydataurls/應(yīng)該進(jìn)入do.host.cn域下的/apis/pl/getStickGoInfo。而不應(yīng)該出現(xiàn)10.8.1.10:8080/apis/pl/getStickGoInfo。
?
轉(zhuǎn)載于:https://www.cnblogs.com/tom-zhao/p/3910569.html
總結(jié)
以上是生活随笔為你收集整理的nginx 跨域。。。掉坑里了,小心的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 寄生虫程序php版价格_php动态寄生虫
- 下一篇: 关闭vb6.0 时报内存不能为read