Java实现Nginx请求转发_为什么我的Nginx没有将请求转发到tomcat的端口?

我在/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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值