Skip to content

Commit 2ae36a4

Browse files
committed
connect.phpのリダイレクトURLをHTTPSに更新し、index.htmlのエンドポイントもHTTPSに変更。setup.shにnginxの設定を追加し、nginx.confを新規作成。
1 parent b75ce71 commit 2ae36a4

4 files changed

Lines changed: 53 additions & 2 deletions

File tree

connect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
$id = uniqid();
2424
file_put_contents("/tmp/$id.json", json_encode($_GET));
2525

26-
header("Location: http://shell.opencloudshell.com:7681/?arg=$id");
26+
header("Location: https://shell.opencloudshell.com/?arg=$id");

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
const { useMemo, useState } = React;
166166

167167
function App() {
168-
const [endpoint, setEndpoint] = useState("http://shell.opencloudshell.com/connect.php");
168+
const [endpoint, setEndpoint] = useState("https://shell.opencloudshell.com/connect.php");
169169
const [port, setPort] = useState("");
170170
const [destination, setDestination] = useState("");
171171
const [password, setPassword] = useState("");

server/nginx.conf

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
map "$uri$arg_arg" $index_no_arg {
2+
"/" 1;
3+
default 0;
4+
}
5+
6+
server {
7+
listen 80 default_server;
8+
listen [::]:80 default_server;
9+
listen 443 ssl default_server;
10+
listen [::]:443 ssl default_server;
11+
ssl_certificate /etc/letsencrypt/live/shell.opencloudshell.com/fullchain.pem;
12+
ssl_certificate_key /etc/letsencrypt/live/shell.opencloudshell.com/privkey.pem;
13+
include /etc/letsencrypt/options-ssl-nginx.conf;
14+
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
15+
16+
root /root/OpenCloudShell;
17+
18+
index index.html index.htm index.nginx-debian.html;
19+
20+
server_name _;
21+
22+
location ~ \.php$ {
23+
include snippets/fastcgi-php.conf;
24+
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
25+
}
26+
27+
location ~ ^/__serve_static(.*)$ {
28+
internal;
29+
rewrite ^/__serve_static(.*)$ $1 break;
30+
try_files $uri $uri/ =404;
31+
}
32+
33+
location / {
34+
if ($index_no_arg) {
35+
rewrite ^ /__serve_static$uri last;
36+
}
37+
proxy_http_version 1.1;
38+
proxy_set_header Host $host;
39+
proxy_set_header X-Forwarded-Proto $scheme;
40+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
41+
proxy_set_header Upgrade $http_upgrade;
42+
proxy_set_header Connection "upgrade";
43+
proxy_pass http://127.0.0.1:7681;
44+
}
45+
}

server/setup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ apt install -y nginx php php-fpm certbot python3-certbot-nginx
33
systemctl stop apache2
44
systemctl disable apache2
55

6+
nginx -t
7+
systemctl restart nginx
8+
69
git clone https://github.com/GitHub30/OpenCloudShell
710
vi /etc/nginx/sites-available/default
811
vi /etc/default/ttyd
912
systemctl restart ttyd
13+
14+
certbot --nginx -d opencloudshell.com -d www.opencloudshell.com
15+
certbot --nginx -d shell.opencloudshell.com

0 commit comments

Comments
 (0)