diff --git a/package-lock.json b/package-lock.json index eb2401f..b9b26d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.35.1", "license": "MIT", "dependencies": { - "axios": "^1.6.2", + "axios": "^1.6.3", "cli": "^1.0.1", "dotenv": "^16.3.1", "express": "^4.18.2", @@ -172,9 +172,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz", + "integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -1171,9 +1171,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz", + "integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==", "requires": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", diff --git a/package.json b/package.json index a261f3f..d3f9410 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tools-init.nginx.conf b/tools-init.nginx.conf index 599db6e..3149800 100644 --- a/tools-init.nginx.conf +++ b/tools-init.nginx.conf @@ -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/; + } +} diff --git a/tools-init.nginx.yml b/tools-init.nginx.yml index e1a3875..6ce246d 100644 --- a/tools-init.nginx.yml +++ b/tools-init.nginx.yml @@ -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' diff --git a/tools-init.sh b/tools-init.sh index 47a2210..52f8d93 100644 --- a/tools-init.sh +++ b/tools-init.sh @@ -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 @@ -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 @@ -54,7 +54,6 @@ if [ ! -d "./webssh2" ]; then echo "require('.');" > app.js cd ../.. fi -DISABLED npm i chmod +x sudoutil.js