用于提供一個(gè)ssh終端訪問工具
ssh2 版本:1.3.1
此插件依賴ssh2
擴(kuò)展,以Ubuntu 20.04.5 LTS
為例
apt update
apt install gcc libssl-dev make -y
//libssh2 使用1.10.0版本
wget https://www.libssh2.org/download/libssh2-1.10.0.tar.gz
tar -zxvf libssh2-1.10.0.tar.gz
cd libssh2-1.10.0
./configure
make
make install
//ssh2擴(kuò)展 使用1.3.1版本
wget https://pecl.php.net/get/ssh2-1.3.1.tgz
tar -zxvf ssh2-1.3.1.tgz
cd ssh2-1.3.1
phpize
./configure --with-ssh2
make
make install
修改php.ini配置,開啟
ssh2
擴(kuò)展
webman-admin 應(yīng)用市場安裝插件
修改插件配置文件 plugin/mterm/config/process
return [
'ssh_ws'=>[
'handler'=> \plugin\mterm\process\SSH::class,
//服務(wù)監(jiān)聽地址
'listen' =>"websocket://0.0.0.0:28889",
//修改進(jìn)程數(shù)
'count'=> 1
]
];
若修改了服務(wù)監(jiān)聽地址,請(qǐng)注意修改網(wǎng)頁連接信息配置,修改插件配置文件 plugin/mterm/config/web
return [
//網(wǎng)頁websocket連接地址+
"ssh_connect_addr"=>"ws://127.0.0.1:28889",
];
使用 nginx 進(jìn)行代理,參照下面配置
location ^~ /mterm/ssh
{
#proxy_pass 地址根據(jù)實(shí)際監(jiān)聽地址修改
proxy_pass http://127.0.0.1:28889;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
修改插件配置文件 plugin/mterm/config/web
return [
//網(wǎng)頁websocket連接地址 /mterm/ssh 為 nginx 代理路徑
"ssh_connect_addr"=>"/mterm/ssh",
];