<big id="lib1s"><dl id="lib1s"></dl></big>
  • <legend id="lib1s"></legend>

    <tr id="lib1s"></tr>

    <big id="lib1s"></big>


    >> 回到列表

    在 Linux 上使用 Systemd 托管 ExpressOA Core 2.0 PDF打印版



    如何在 Linux 上安裝 ASP.NET Core 6.0
    根據你使用的 Linux 發行版,請參考微軟官方文檔執行安裝命令。
    在 Ubuntu 上安裝 .NET SDK 或 .NET 運行時

    (1)配置 Kestrel Web 服務器
    1.1 配置 Kestrel 綁定本機端口。
    打開【/runroot/appsettings.json】,可以看到 Kestrel 默認綁定本機地址和端口【localhost:5000】。
    localhost 等于 127.0.0.1,使用 Kestrel 綁定本機地址和端口,可以與反向代理(Nginx, Apache)一起使用。
    你可以自定義 Kestrel 綁定的端口(建議端口范圍 5000-60000),只要該端口沒有占用。
    "Kestrel": {
        "Endpoints": {
          "Http": {
            "Url": "http://localhost:5000"
          }
        }
      }
    

    1.2 在 Linux 命令行中啟動 Kestrel Web 服務器。
    Linux 命令
    sudo dotnet /expressoa/approot/runroot/ExpressOA.dll
    

    1.3 驗證 Kestrel 是否正常工作。
    Linux 命令
    curl http://localhost:5000
    


    (2)配置 Kestrel 獨立提供服務。
    本章節演示配置 Kestrel 綁定域名和 SSL 證書,獨立提供服務。
    在驗證【HTTPS】訪問成功后,啟用【HttpsRedirection】跳轉。

    2.1 使用【vim】編輯【/runroot/appsettings.json】配置 Kestrel Web 服務器。
    Linux 命令
    sudo vim /expressoa/approot/runroot/appsettings.json
    

    【Kestrel-Url】如何綁定
    http://localhost:5000(http 監聽本機網卡回環地址:5000 端口,只能在本機訪問)
    http://*:5000( http 監聽所有 IP 地址:5000 端口)
    http://office.paicore.com(http 監聽本機所有 IP 地址:80 端口)
    https://office.paicore.com(https 監聽本機所有 IP 地址:443 端口)
    
    【appsettings.json】配置如下:
      "Kestrel": {
        "Endpoints": {
          "Http": {
            "Url": "http://office.paicore.com"
          },
          "Https": {
            "Url": "https://office.paicore.com",
            "Certificate": {
              "Path": "/expressoa/approot/office.paicore.com.pfx",
              "Password": "Your Password"
            }
          }
        }
      },
     "HttpsRedirection": false,
    

    2.2 在 Linux 命令行中啟動 Kestrel Web 服務器。
    Linux 命令
    sudo dotnet /expressoa/approot/runroot/ExpressOA.dll
    

    2.3 驗證測試 HTTP 和 HTTPS 配置成功。
    Linux 命令
    curl http://office.paicore.com
    

    Linux 命令
    curl -4 https://office.paicore.com
    

    2.4 將 HTTP 重定向到 HTTPS
    使用【vim】編輯【/runroot/appsettings.json】,修改【"HttpsRedirection": true】。


    (3)使用 Systemd 托管 ExpresOA Core 2.0
    3.1 配置 Linux 后臺服務【expressoa.service】。 拷貝【/runroot/expressoa.service】到【/etc/systemd/system】。
    Linux 命令
    sudo cp /expressoa/approot/runroot/expressoa.service /etc/systemd/system
    

    使用【vim】編輯【expressoa.service】,把部署路徑【/expressoa/approot/】修改為實際的部署路徑。
    Linux 命令
    sudo vim /expressoa/approot/runroot/expressoa.service
    
    expressoa.service
    [Unit]
    Description=ExpressOA Pro
    
    [Service]
    WorkingDirectory=/expressoa/approot/runroot
    ExecStart=/usr/bin/dotnet /expressoa/approot/runroot/ExpressOA.dll
    
    Restart=always
    RestartSec=10
    SyslogIdentifier=expressoa
    User=root
    Environment=DOTNET_ROOT=/usr/lib64/dotnet
    TimeoutStopSec=30
    
    [Install]
    WantedBy=multi-user.target
    

    3.2 啟動服務【expressoa.service】。
    安裝服務
    Linux 命令
    sudo systemctl enable /etc/systemd/system/expressoa.service
    

    啟動服務
    Linux 命令
    sudo systemctl start expressoa
    

    停止服務
    Linux 命令
    sudo systemctl stop expressoa
    

    查看服務狀態
    Linux 命令
    sudo systemctl status expressoa
    



    © 派勝公司  -   商標  -   服務條款  -   聯系派勝

    隆尧县| 温泉县| 金乡县| 尚志市| 勐海县| 抚州市| 龙山县| 察雅县| 新乡市| 黎平县| 确山县| 西畴县| 汉中市| 赤城县| 岐山县| 固始县| 南昌县| 宿松县| 寿宁县| 伽师县| 稷山县| 九龙坡区| 固原市| 来安县| 翁牛特旗| 南乐县| 涿州市| 肥东县| 泾源县| 怀远县| 当涂县| 潼关县| 同仁县| 呼伦贝尔市| 徐州市| 故城县| 礼泉县| 攀枝花市| 双江| 昂仁县| 广丰县| http://www.386250.com http://www.704368.com http://www.jialanda.com