nginx url rewrite for reverse proxy

后端 未结 1 1303
无人共我
无人共我 2021-01-03 02:48

I have an nginx on port 80 and a tomcat on port 8080 configured as upstream.

The war application in tomcat listen to /pwm.

I would like to configure nginx to

相关标签:
1条回答
  • 2021-01-03 03:19

    Ok, I found a solution for me:

    location / {
        rewrite ^ http://web.noc.local/pwm/ last;
    }
    
    location /pwm {
    
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    
        proxy_max_temp_file_size 0;     
        proxy_buffering off;
        proxy_connect_timeout 30;
        proxy_send_timeout 30;
        proxy_read_timeout 30;
        proxy_pass http://pwm_server;
    }
    
    0 讨论(0)
提交回复
热议问题