發表文章

git + cpanel 環境及網站建置

圖片
零、學前知識 我們的目標是用自己的私要去連 cPanel 的公鑰,而 cPanel 會透過另外一組私鑰公鑰去連 Bitbucket,這樣我們就可以透過 ssh 連線用 git 來更新程式 一、進入 cpanel 建立 SSH key 1. 選擇「安全性 > SSH 存取」 2. 點「管理 SSH 金鑰」 3. 點「產生新金鑰」 4. 輸入金鑰名稱及密碼 5. 建立成功,返回 SSH 管理介面 6. 點「管理」進入修改授權狀態 二、匯入 bitbucket 用的 SSH key 1. 進入 i.baXXXocat.net 的 cpanel > 安全性 > SSH 存取 > 管理 SSH 金鑰 > Private Key > View/Download 2. 將中間那堆字複製下來 3. 回到我們的 cpanel 匯入金鑰 三、連線 先到 cPanel > Security > SSH Access > Manage SSH Keys 下載 Private Keys 放到本機家目錄下的 .ssh 資料夾,並且設定 config (for windows) Host i.baXXXocat.net User ibaXXXoc@i.baXXXocat.net IdentityFile ~/.ssh/bdc 開啟 git bash 輸入指令:ssh account@host,ex:ibaXXXoc@i.baXXXocat.net 第一次連線會問你一個問題,我忘記是什麼了,反正打 yes 就對了 四、建立專案 clone 專案 from bitbucket 把 clone 下來的資料夾內容搬回網站根目錄 刪除不必要的資料夾,ex:install .git 資料夾加入 .htaccess 檔案,禁止別人連線到這個資料夾 .htaccess 內容如下: <Files "*"> Order Allow,Deny Deny from All ...

圖片 Responsive

div > img { width: auto; height: auto; max-height: 100%; max-width: 100%; } 如果要置中的話,再加上 position 設定。 div { position: relative; } img { width: auto; height : auto; max-height: 100%; max-width: 100%; position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; }

[Windows] 遠端連線錯誤的解法

錯誤訊息:遠端工作階段中斷,因為沒有終端機伺服器用戶端存取授權供這部電腦使用 解法: 在 '執行' 輸入: regedit 開啟登入編輯程式,找到這個位置 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing 的機碼 (就是資料夾啦~)砍掉它! 重新連線一次,應該就可以了。 如果還是不能連它又會噴一次錯誤,來不及紀錄中文,請看下面的英文,然後跳第三步。 If it doesn’t work and you get the following error message: “The remote computer disconnected the session because of an error in the licensing protocol“ 在遠端桌面連線按右鍵,以系統管理員身分執行即可。

文字太長省略成「...」

overflow : hidden; text-overflow : ellipsis; white-space : nowrap; 補充: 如果設定在 td 標籤會發現沒有作用,因為 td 屬性是 table cell,如果是一般的 block 就會正常,可以修改如下 td { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

[Windows] 清除 DNS Cache

方法 1 執行 cmd ipconfig /flushdns 看到此行字即完成:successfully flushed the dns resolver cache 方法 2 控制台→管理工具→服務 重新啟動 DNS Client 和 DHCP Client 服務即可。

[PHP] Class 'ZipArchive' not found

在 Windows下的解決辦法是: 在 php.ini 中,將 extension=php_zip.dll 前面的分號 “;” 刪除,同樣在 php.ini 中,將 zlib.output_compression = Off 改為 zlib.output_compression = On 重啟 Apache

mysqlnd cannot connect to MySQL 4.1+

修改 AppServ/MySQL/my.ini 將 old_passwords=1 註解 使用系統 command 登入 mysql,mysql.exe 放在 MySQL\bin 裡面,指令: mysql -u root -p 登入後修改密碼 (帳號密碼請自行變更) mysql> SET old_passwords=FALSE; mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('88888888'); mysql> flush privileges; 重新啟動 mysql