查看: 3342|回复: 3

http通过nginx进行跳转为https

升级   2.06%

10

主题

20

回帖

206

积分

注册会员

Rank: 2

积分
206
发表于 2023-9-25 16:21:47 | 显示全部楼层 |阅读模式
通过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_type  application/octet-stream;
   charset  utf-8;
   #access_log  logs/access.log  main;
   client_max_body_size 100m; # 数据包大小限制
   sendfile        on;
   tcp_nopush     on;
   keepalive_timeout  65;
   #gzip  on;
   upstream o2Server {                # Server: 分发名
     server 106.55.179.217:8080  weight=5  max_fails=3  fail_timeout=10s;        # 分发地址1
     server 106.55.188.250:8080  weight=5  max_fails=3  fail_timeout=10s;        # 分发地址2
     server 175.178.94.26:8080  weight=5  max_fails=3  fail_timeout=10s;       # 分发地址2
   }
   server {
       listen       8081;
       server_name  106.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;
                index  index.html;
                proxy_pass  http://o2Server;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $host;
        }

}
   }



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

升级   6.33%

9

主题

38

回帖

633

积分

注册会员

Rank: 2

积分
633
发表于 2023-9-26 09:42:45 | 显示全部楼层
nginx跟O2OA是部署在同一台上的吗?

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

使用道具 举报

升级   2.06%

10

主题

20

回帖

206

积分

注册会员

Rank: 2

积分
206
发表于 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为域名的证书
回复

使用道具 举报

升级   100%

0

主题

662

回帖

2

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2
发表于 2023-9-27 09:22:11 | 显示全部楼层
node配置中proxyHost要设置为nginx访问的域名或者ip,proxyPort要设置为nginx访问的端口,看nginx的配置应该要设置为443
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系客服 关注微信 下载APP 返回顶部 返回列表
viewthread