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

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

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


    >> 回到列表

    使用 Apache 在 Linux 上托管 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 驗證 Kestrel 是否正常工作。
    在 Linux 命令行中啟動 Kestrel Web 服務器。
    Linux 命令
    sudo dotnet /expressoa/approot/runroot/ExpressOA.dll
    

    測試 HTTP 訪問 Kestrel Web 服務器。
    Linux 命令
    curl http://localhost:5000
    

    1.3 配置 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
    

    1.4 啟動服務【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
    

    (2)安裝 Apache
    安裝 Apache
    Linux 命令
    sudo apt update
    sudo apt install apache2
    

    首次啟動 Apache
    sudo service apache2 start
    

    啟動 Apache
    sudo systemctl start apache2
    

    重啟 Apache
    sudo systemctl restart apache2
    

    停止 Apache
    sudo systemctl stop apache2
    

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

    (3)配置 Apache 反向代理
    Apache 的配置文件位于 /etc/httpd/conf.d/ 目錄內。
    在 Ubuntu 上的 Apache 中,所有虛擬主機配置文件都存儲在 /etc/apache2/sites-available 中。
    除了 /etc/httpd/conf.modules.d/ 中的模塊配置文件外,將對任何帶 .conf 擴展名的文件按字母順序進行處理。
    配置 Apache 反向代理,把外部 HTTP 請求轉發到 Kestrel 監聽地址 http://127.0.0.1:5000/ 。
    為應用創建名為 expressoa.conf 的配置文件:
    Apache 配置文件
    <VirtualHost *:*>
        RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
    </VirtualHost>
    <VirtualHost *:80>
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:5000/
        ProxyPassReverse / http://127.0.0.1:5000/
        ServerName office.paicore.com
        ServerAlias *.paicore.com
        ErrorLog ${APACHE_LOG_DIR}expressoa-error.log
        CustomLog ${APACHE_LOG_DIR}expressoa-access.log common
    </VirtualHost>
    



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

    甘德县| 内丘县| 普陀区| 英超| 自贡市| 海晏县| 花莲县| 江北区| 吐鲁番市| 玉屏| 都兰县| 衡山县| 西城区| 潜江市| 琼中| 安康市| 乐山市| 郸城县| 安国市| 长泰县| 张掖市| 泽库县| 阿瓦提县| 西城区| 古浪县| 烟台市| 佛学| 贵南县| 比如县| 安泽县| 湘潭市| 台前县| 许昌县| 秭归县| 凉山| 江孜县| 霍州市| 金坛市| 宝山区| 渝中区| 南昌县| http://www.kmycxslyp.com http://www.ldvybz.com http://www.lankln.com