hppys 发表于 2023-9-25 16:21:47

http通过nginx进行跳转为https

通过nginx的端口访问,实现跳转,页面一直在转圈


node_106.55.179.217.json为

"enable": true,
"center": {
    "enable": true,
    "order": 0.0,
    "sslEnable": false,
    "port": 8080.0,
    "httpProtocol": "",
    "proxyHost": "106.55.179.217",
    "proxyPort": 8080.0,
    "###enable": "是否启用###",
    "###order": "center节点顺序,顺序排列0,1,2...###",
    "###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###",
    "###port": "端口,center服务器端口,默认20030###",
    "###httpProtocol": "对外http访问协议,http/https###",
    "###proxyHost": "代理主机,当服务器是通过apache/nginx等代理服务器映射到公网或者通过路由器做端口映射,在这样的情况下需要设置此地址以标明公网访问地址.###",
    "###proxyPort": "代理端口,当服务器是通过apache/nginx等代理服务器映射到公网或者通过路由器做端口映射,在这样的情况下需要设置此地址以标明公网访问端口.###",
    "###extension": "扩展设置.###"
},
"application": {
    "enable": true,
    "port": 8080.0,
    "sslEnable": false,
    "proxyHost": "106.55.179.217",
    "proxyPort": 8080.0,
    "includes": [],
    "excludes": [],
    "###enable": "是否启用###",
    "###port": "http/https端口,负责向前端提供数据访问接口.默认为20020端口.###",
    "###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###",
    "###proxyHost": "代理主机,当服务器是通过apache/nginx等代理服务器映射到公网或者通过路由器做端口映射,在这样的情况下需要设置此地址以标明公网访问地址.###",
    "###proxyPort": "代理端口,当服务器是通过apache/nginx等代理服务器映射到公网或者通过路由器做端口映射,在这样的情况下需要设置此地址以标明公网访问端口.###",
    "###includes": "承载的应用,在集群环境下可以选择仅承载部分应用以降低服务器负载,可以使用*作为通配符.###",
    "###excludes": "选择不承载的应用,和includes的值配合使用可以选择或者排除承载的应用,可以使用*作为通配符.###",
    "###extension": "扩展设置.###"
},
"web": {
    "enable": true,
    "port": 8080.0,
    "sslEnable": false,
   "proxyHost": "106.55.179.217",
   "proxyPort": 8080.0,
    "proxyCenterEnable": true,
    "proxyApplicationEnable": true,
    "proxyTimeOut": 300.0,
    "###enable": "是否启用###",
    "###port": "http/https端口,用户输入网址后实际访问的第一个端口.http协议默认为80端口,https默认为8080.0端口.###",



nginx配置文件为

http {
   include       mime.types;
   default_typeapplication/octet-stream;
   charsetutf-8;
   #access_loglogs/access.logmain;
   client_max_body_size 100m; # 数据包大小限制
   sendfile      on;
   tcp_nopush   on;
   keepalive_timeout65;
   #gzipon;
   upstream o2Server {                # Server: 分发名
   server 106.55.179.217:8080weight=5max_fails=3fail_timeout=10s;      # 分发地址1
   server 106.55.188.250:8080weight=5max_fails=3fail_timeout=10s;      # 分发地址2
   server 175.178.94.26:8080weight=5max_fails=3fail_timeout=10s;       # 分发地址2
   }
   server {
       listen       8081;
       server_name106.55.179.217;
       return 301 https://$host$request_uri;
       }


    server {

    listen 443 ssl;
    server_name   106.55.179.217;
    ssl_certificate_key /etc/pki/CA/private/server.key;
    ssl_certificate   /etc/pki/CA/certs/server.crt;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    location / {
                root html;
                indexindex.html;
                proxy_passhttp://o2Server;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $host;
      }

}
   }



双鱼座 发表于 2023-9-26 09:42:45

nginx跟O2OA是部署在同一台上的吗?

https://www.o2oa.net/cms/serverdeployment/464.html   《系统架构-O2OA基于nginx的SSL跳转、转发配置》 官网上有这份文章可以看看,在系统设置中 配置上nginx的地址以及端口

hppys 发表于 2023-9-26 10:12:33

双鱼座 发表于 2023-9-26 09:42
nginx跟O2OA是部署在同一台上的吗?

https://www.o2oa.net/cms/serverdeployment/464.html   《系统架构-O ...

对的,nginx和o2oa都部署在同一台服务器,我使用的是ip访问,没有设置域名,我参考文档就是我用的是OpenSSL自签IP为域名的证书

启蒙星 发表于 2023-9-27 09:22:11

node配置中proxyHost要设置为nginx访问的域名或者ip,proxyPort要设置为nginx访问的端口,看nginx的配置应该要设置为443
页: [1]
查看完整版本: http通过nginx进行跳转为https