<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### 整體流程 >1、在服務器上生成部署公鑰 >2、在github上對項目做部署配置 >3、配置域名,初次拉取代碼到服務器 >4、編寫腳本,保存至服務器 >5、測試腳本,發布項目 ### 需求 > 把github上的項目自動發布到指定的服務器,即自動部署 ### 環境與設備說明 > 1、遠程服務器一臺(代碼自動部署到此服務器) > 2、github項目(我們的代碼存到github) > 3、開發計算機(本地開發) > 4、域名管理 ### 生成發布公鑰 > 位置:服務器 1、在服務器上安裝git,省略 2、git安裝完畢后,執行命令 ~~~ ssh -keygen ~~~ 后面直接回車,不要輸入密碼,這樣使用公鑰的時候就無需密碼了 3、生成的公鑰默認存放在用戶目錄下的.ssh目錄,默認名稱為id_ras和id_ras.pub,其中id_ras.pub為公鑰文件,也就是要上傳到github上的文件 ### github項目配置 >位置: github 1、選擇添加公鑰 ![添加公鑰](https://box.kancloud.cn/ea6d2514a7eca99fb654473d74f8b587_1059x439.jpg =600x300) 2、進入添加公鑰界面,填寫標題和內容,標題隨意,內容為第一步生成的公鑰的內容,保存后添加成功 ![填寫頁面](https://box.kancloud.cn/44114a14a8ab3718a69368664346b972_1048x521.png =600x300) 因為是危險操作,需要輸入用戶github的密碼來確認 添加成功 ![證書添加成功](https://box.kancloud.cn/747bf9725452a297682b5be2370102bd_1080x298.png =600x300) 3、配置webhook,填寫自動部署所需要的腳本和secret ![新建webhook](https://box.kancloud.cn/c4494d475f59a9186a64ba3f151f35a9_1157x442.png =600x300) 詳細設置 ![webhook的詳細設置](https://box.kancloud.cn/ac40968b66bdfb14e41f5953bb83d71c_993x650.png =600x300) 配置完成后,點擊add webhook, github項目的配置即完成。 ![webhook配置成功](https://box.kancloud.cn/13b87309d9c1394696cdd4ec2cb993e9_1067x355.png =600x300) ### 配置域名,拉取代碼到服務器 >位置:服務器 1、添加域名,指向服務器 ![域名管理](https://box.kancloud.cn/9e66c773001ab324e625499dea209fe7_1207x324.png =600x300) 2、在服務器上拉取項目 ~~~ git clone https://github.com/wmhello/apidemo ~~~ 3、本地web服務器配置后,域名指向項目(不同的框架可以按不同的要求來配置) 4、服務器代碼部署成功后,通過域名可以訪問網站 ![ 服務器部署](https://box.kancloud.cn/902f4d61772c067c086903886c7b9a75_1352x424.png =600x300) ### 編寫腳本 >位置:服務器 編寫腳本,存放至配置webhook時指定的存放位置,并注意名稱一定要相符 ~~~ <?php // 與webhook配置相同,為了安全,請設置此參數 $secret = "wmhello"; // 項目路徑 $path = "d:/www/apidemo"; // 校驗發送位置,正確的情況下自動拉取代碼,實現自動部署 $signature = $_SERVER['HTTP_X_HUB_SIGNATURE']; if ($signature) { $hash = "sha1=".hash_hmac('sha1', file_get_contents("php://input"), $secret); if (strcmp($signature, $hash) == 0) { echo shell_exec("cd \ && cd {$path} && git pull 2>&1"); exit(); } } http_response_code(404); ?> ~~~ ### 測試自動發布 >位置:開發機 服務器 在本地計算機增加代碼后,提交到github倉庫,代碼自動同步到服務器,實現了自動發布的功能
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看