zoukankan      html  css  js  c++  java
  • jexus+.netcore+identityserver4 部署支持ssl(https)

    硬件环境: 在阿里云购买了一个centos 7 64 位服务器

    软件: jexus ,dotnet core sdk  

    第一步安装dotnet core sdk:

        先安装dotnet core sdk 

        下载:   https://www.microsoft.com/net/download/linux  对应版本的sdk

        解压并配置环境变量:

        sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet  

        配置环境变量: vi ~/。bash_profile 增加一行: export PATH=$PATH:$HOME/dotnet

       运行命令看下 dotnet -info 可用

    第二步安装jexus : 参考:https://www.cnblogs.com/shanyou/p/jexus582.html 安装

       配置自己的程序,我将我的程序发布到/var/www/webapi/目录下,先保证我的网站是否可以启动ok

      dotnet /var/www/webapi/webapi.dll    

     执行命令看下自己的网站有跑起来吗?

    第三步配置SSL   :

    首先在获取证书,可以使用https://zerossl.com/free-ssl/  获取个免费证书

    也可以直接购买一个证书或自己生成一个

    拿到证书之后开始配置,jexus 证书可以配置每个站点一个证书,也可以全局的,这里我配置全局的,/usr/jexus/jws.conf

    CertificateFile = /usr/jexus/xxx.crt
    CertificateKeyFile = /usr/jexus/xxx.key

    然后配置自己站点文件site1

    我的是这样配置的

    port=443
    root=/ /var/www/webapi
    hosts=xxxx.your.com   #OR your.com,*.your.com
    AppHost={
    CmdLine=dotnet /var/www/webapi/webapi.dll;
    AppRoot=/var/www/webapi;
    Port=5000;
    OutLog=/tmp/log/jexus/out1.txt;
    ErrorLog=/tmp/log/jexus/error1.txt;
    }

    UseHttps=true

    我在部署的地方碰到了两个问题:

    1.identityserver4   执行 https://xxxx/.well-known/openid-configuration   里面 uri 都是http 不是https 

    这个需要在 startup.cs

     services.AddIdentityServer(options =>
                {
    
                    options.PublicOrigin = "https://xxx.your.com";
                    
                })

    2.访问授权action的时候会重定向到登陆页面,本来是https 协议的跳到登陆页面居然是http协议的,找了半天,只能看看jexus 是否有http to https 的方式

    配置之后ok解决问题,jexus 配置一个80端口监听但是不能和443 的域名一样,得配置一个和442不一样的域名,否则不跳转,终于没有问题了

    在这个部署过程有一个始终没有搞定,jexus 自动启动的配置,希望有知道给出方法!

  • 相关阅读:
    vmware ubuntu 异常关机无法连接到网络
    Speed up GCC link
    常用的一些解压命令
    Log4j 漏洞复现
    Test Case Design method Boundary value analysis and Equivalence partitioning
    CCA (Citrix Certified Administrator) exam of “Implementing Citrix XenDesktop 4”
    What is Key Word driven Testing?
    SAP AGS面试小结
    腾讯2013终端实习生一面
    指针的引用
  • 原文地址:https://www.cnblogs.com/chenzhe/p/7844790.html
Copyright © 2011-2022 走看看