nginx 代理 web service 提供 soap + xml 服务

nginx 代理 web service 提供 soap + xml 服务

最关键的配置:

conf 复制代码
# Nginx默认反向后的端口为80,因此存在被代理后的端口为80的问题,这就导致访问出错。主要原因在Nginx的配置文件的host配置时没有设置响应的端口。Host配置只有host,没有对应的port,这就导致在被代理的地方取得错误的端口。所以修改配置如下
proxy_set_header Host $host:$server_port;

nginx 配置文件

conf 复制代码
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
  include       mime.types;
  default_type  application/octet-stream;

  #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  #                  '$status $body_bytes_sent "$http_referer" '
  #                  '"$http_user_agent" "$http_x_forwarded_for"';

  #access_log  logs/access.log  main;

  sendfile        on;
  #tcp_nopush     on;

  #keepalive_timeout  0;
  keepalive_timeout  65;

  #gzip  on;

  server {
    listen       8081;
    server_name  localhost;

    location / {
      root   html;
      index  index.html index.htm;
    }

    location /services/ws {
      proxy_pass http://localhost:8080/services/ws;
      proxy_set_header Host $host:$server_port;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_connect_timeout 600;
      proxy_read_timeout 600;
      proxy_send_timeout 600;
      proxy_set_header X-Original-URI $request_uri;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
  }
}
相关推荐
BelongPanda19 小时前
Linux Nginx 纯手动 Let‘s Encrypt 泛域名证书配置教程
linux·nginx
郝亚军1 天前
nginx的三个基础库:PCRE、OpenSSL、Zlib的安装
linux·服务器·nginx
CodexDave1 天前
MySQL事务隔离级别与MVCC机制解析
前端·数据库·mysql·nginx·性能优化·负载均衡
chexus2 天前
20. 深入 Nginx 信号处理
linux·c语言·网络·nginx
名字还没想好☜3 天前
Nginx 反向代理与负载均衡配置实战
运维·nginx·负载均衡
砍材农夫3 天前
运维|devops|nginx|基本配置拆解
运维·nginx·devops
三8443 天前
笔记:在同一个物理服务器上通过nginx的虚拟主机生成多个不同的web站点
java·前端·nginx
lastHertz4 天前
Nginx安装部署
运维·nginx
开发小程序的之朴4 天前
安企CMS的安装-PHPStudy(小皮面板)部署
windows·mysql·nginx
MMendex4 天前
Nginx_day4——uWSGI,灰度发布,网站限流限速,Nginx跨域
运维·nginx