Skip to content

Commit

Permalink
Use WebSSH2
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Dec 27, 2023
1 parent 8127f87 commit 2c8a2de
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 81 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "MIT",
"type": "module",
"dependencies": {
"axios": "^1.6.2",
"axios": "^1.6.3",
"cli": "^1.0.1",
"dotenv": "^16.3.1",
"express": "^4.18.2",
Expand Down
88 changes: 43 additions & 45 deletions tools-init.nginx.conf
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
server {
root ~/public_html/public;
location /phpmyadmin/ {
root ~/public_html/;
location ~ \.php(/|$) {
try_files $uri =404;
fastcgi_pass localhost:1234;
}
}
location /phppgadmin/ {
root ~/public_html/;
location ~ \.php(/|$) {
try_files $uri =404;
fastcgi_pass localhost:1234;
}
}
location /webssh/ {
root ~/public_html/webssh/webssh/static;
passenger_app_root ~/public_html/webssh;
passenger_enabled on;
passenger_app_start_command "python run.py --port=$PORT";
passenger_base_uri "/webssh";
rewrite ^/webssh/(.*)$ /$1 break;
passenger_document_root ~/public_html/webssh/webssh/static;
}
location /ssh/ {
root ~/public_html/webssh2/app/client/public;
passenger_app_root ~/public_html/webssh2/app;
passenger_enabled on;
passenger_base_uri "/ssh";
passenger_sticky_sessions on;
rewrite ^/webssh2/(.*)$ /$1 break;
passenger_document_root ~/public_html/webssh2/app/client/public;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
server {
root ~/public_html/public;
location /phpmyadmin/ {
root ~/public_html/;
location ~ \.php(/|$) {
try_files $uri =404;
fastcgi_pass localhost:1234;
}
}
location /phppgadmin/ {
root ~/public_html/;
location ~ \.php(/|$) {
try_files $uri =404;
fastcgi_pass localhost:1234;
}
}
location /webssh/ {
root ~/public_html/webssh/webssh/static;
passenger_app_root ~/public_html/webssh;
passenger_enabled on;
passenger_app_start_command "python run.py --port=$PORT";
passenger_base_uri "/webssh";
rewrite ^/webssh/(.*)$ /$1 break;
passenger_document_root ~/public_html/webssh/webssh/static;
}
location /ssh/ {
root /home/bridge/public_html/webssh2/app/client/public;
passenger_app_root /home/bridge/public_html/webssh2/app;
passenger_app_start_command "env PORT=$PORT node app.js";
passenger_document_root /home/bridge/public_html/webssh2/app/client/public;
passenger_enabled on;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 1200s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 1200s;

proxy_pass http://127.0.0.1:2223/;
}
}
proxy_pass http://127.0.0.1:2223/;
}
}
55 changes: 30 additions & 25 deletions tools-init.nginx.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
root: public_html/public
nginx:
locations:
- match: /phpmyadmin/
root: public_html
fastcgi: on
- match: /phppgadmin/
root: public_html
fastcgi: on
webssh:
match: /webssh/
root: public_html/webssh/webssh/static
rewrite: ^/webssh/(.*)$ /$1 break
passenger:
enabled: on
app_start_command: python run.py --port=$PORT
base_uri: /webssh
document_root: public_html/webssh/webssh/static
webssh2:
match: /webssh2/
root: public_html/webssh2/app/client/public
rewrite: ^/webssh/(.*)$ /$1 break
passenger:
enabled: on
base_uri: /webssh2
document_root: public_html/webssh2/app/client/public
app_root: public_html/webssh2/app
- fastcgi: 'on'
root: public_html/
passenger:
enabled: 'off'
match: /phpmyadmin/
- fastcgi: 'on'
root: public_html/
passenger:
enabled: 'off'
match: /phppgadmin/
- root: public_html/webssh/webssh/static
passenger:
app_root: public_html/webssh
enabled: 'on'
app_start_command: python run.py --port=$PORT
document_root: public_html/webssh/webssh/static
rewrite: ^/webssh/(.*)$ /$1 break
match: /webssh/
- root: public_html/webssh2/app/client/public
passenger:
app_root: public_html/webssh2/app
app_start_command: env PORT=$PORT node app.js
enabled: 'on'
document_root: public_html/webssh2/app/client/public
match: /ssh/
- match: /
fastcgi: 'on'
index: index.html index.php
root: public_html/public
ssl: 'on'
5 changes: 2 additions & 3 deletions tools-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ else
git pull
cd ..
fi

if [ ! -d "./webssh" ]; then
git clone https://github.com/huashengdun/webssh.git webssh --filter=tree:0
cd ./webssh
Expand All @@ -40,11 +41,10 @@ else
cd ..
fi

: <<'DISABLED'
if [ ! -d "./webssh2" ]; then
git clone https://github.com/billchurch/webssh2.git webssh2 --filter=tree:0
cd ./webssh2/app
npm install --production
npm install --omit=dev
cp config.json.sample config.json
hash=`node -e "console.log(require('crypto').randomBytes(16).toString('hex'))"`
sed -i "s/\"host\": null/\"host\": \"localhost\"/g" config.json
Expand All @@ -54,7 +54,6 @@ if [ ! -d "./webssh2" ]; then
echo "require('.');" > app.js
cd ../..
fi
DISABLED

npm i
chmod +x sudoutil.js
Expand Down

0 comments on commit 2c8a2de

Please sign in to comment.