使用nginx监听8070端口,并转发到8067端口
我的配置文件如下:
upstream odoo { server localhost:8067; } upstream odoochat{ server localhost:8072; } server { listen 8070 default_server; listen [::]:8070 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. # try_files $uri $uri/ =404; # proxy_redirect off; proxy_pass http://odoo; # index index.html; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-HOST $host:$server_port; # 关键需要在此处添加端口号变量,或者直接使用端口号8070 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /longpolling{ proxy_pass http://odoochat; }
ps:我是用来反向代理odoo系统,测试结果是ok的
来源:https://www.cnblogs.com/qianxunman/p/12266957.html