我在/var/build/目录下有一个前端项目,让nginx默认打开前端首页,
然后我希望在前端发送请求时将请求转发给tomcat处理
从异常日志来看并没有访问localhost:8080/auth/api/dologin
而是localhost:80/auth/api/dologin (/var/build/auth/api/dologin)
求指教,拜托了
异常日志:
`
2020/01/05 22:17:32 [error] 8674#0: *8 open() "/var/build/auth/api/dologin" failed (2: No such file or directory), client: 192.168.107.1, server: 127.0.0.1, request: "POST /auth/ api/dologin HTTP/1.1", host: "192.168.107.131", referrer: "http://192.168.107.131/"
`
我的nginx.conf
17 http {
18 include mime.types;
19 default_type application/octet-stream;
20
21 #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
22 # '$status $body_bytes_sent "$http_referer" '
23 # '"$http_user_agent" "$http_x_forwarded_for"';
24
25 #access_log logs/access.log main;
26
27 sendfile on;
28 #tcp_nopush on;
29
30 #keepalive_timeout 0;
31 keepalive_timeout 65;
32
33 #gzip on;
34 upstream myserver{
35 server 127.0.0.1:8080;
36 server 127.0.0.1:7070 backup;
37 }
38
39 server {
40 listen 80;
41 server_name 127.0.0.1;
42
43 #charset koi8-r;
44
45 #access_log logs/host.access.log main;
46
47 location / {
48 root /var/build;
49 #proxy_pass http://myserver;
50 index index.html index.htm;
51 }
52 location auth{
53 proxy_pass http://myserver/auth;
54 }
55 location biz {
56 proxy_pass http://192.168.107.131:7070/biz;
57 }
58
59