# Nginx代理OA仅移动端访问

修订时间:20260430

# 配置参考

nginx.conf

worker_processes auto;
worker_rlimit_nofile 20960;
error_log  logs/error.log  error;
events {
    worker_connections  4096;
    multi_accept on;
    accept_mutex on;
    accept_mutex_delay 500ms;
}
http {
    server_tokens off;
    sendfile on;
    tcp_nopush on; 
    tcp_nodelay on;
    access_log off;
    include       mime.types;
    default_type  application/octet-stream;
    keepalive_timeout  300;
    client_max_body_size 10240m;
    proxy_max_temp_file_size 10240m;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 32 16k;
    gzip_comp_level 5;
    gzip_types
        text/xml
        text/plain
        text/css
        text/javascript
        application/json
        application/x-javascript
        application/javascript
        application/xml
        application/xml+rss
        application/xhtml+xml
        application/atom+xml
        application/rss+xml
        image/svg+xml
        application/manifest+json;
    gzip_proxied any;
    gzip_disable "MSIE [1-6]\.";

    # 定义一个upstream,名称(seeyon_v5_cluster,可更改)、模式(必须为sticky)及其服务集(server,192.168.0.1为服务ip,80为http端口,以实际情况进行修改)
    upstream seeyon_v5_cluster{
        # 默认安装的Nginx无sticky模块无法启动,必须参考手册基于Linux或信创进行Nginx+sticky编译才能启动
        sticky;
        server 192.168.0.1:80 max_fails=300 fail_timeout=30s;
        server 192.168.0.2:80 max_fails=300 fail_timeout=30s;
    }

    # 定义一个server
    server {
        # 设置监听端口
        listen 80;
        # 设置 server 名称
        server_name localhost;
        # 设置字符集
        charset utf-8;

        # 设置 location
        include part.conf;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
   }
}

part.conf (与nginx.conf放置同一目录):

location ~ /seeyon/webOfficeTolen.do {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/m3/apps/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/m3/cmp/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/rest/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/apps_res/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /mobile_portal/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/isignaturehtmlH5servlet {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /wechat/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/fontimage/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/common/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/portal/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/H5/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/office/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /favicon.ico {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/commonimage.do {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/skin/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/verifyCodeImage.jpg {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/officeTrans.do {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/getAjaxDataServlet {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ ^/static/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}


location ~ ^/seeyon/.*\.js$ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/main/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/wechat/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

location ~ /seeyon/collaboration/ {
    proxy_pass http://seeyon_v5_cluster;
    proxy_set_header Host $http_host;
    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_redirect http:// $scheme://;
    proxy_connect_timeout 300;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
}

# 问题记录

# 1、苹果手机登录通过短信验证登录M3,验证环节闪退,无法输入四位数验证码

问题现象:

1777527901473.png

分析过程:

通过移动端抓包发现请求验证码的协议不对

手机端发起请求 /seeyon/rest/authentication/captcha 时,响应返回302,重定向到了 /seeyon/verifyCodeImage.jpg 响应头中这个地址的协议不对,该地址是从后端返回的

1777528066472.png

1777528155947.png

说明OA收到的请求头有异常,此时可以检查Nginx配置

发现 part.conf 中没有添加以下配置

proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http:// $scheme://;

修改完reload配置,功能恢复正常。

提示:20260430前参考本手册配置的,都可能遇到该问题。

编撰人:zhangshuang、wangyxyf、admin、het、qiaoyulong