# https://rustix.me/ 的容器建一个网站不行哇？

**URL:** <https://2hkj2s.loc.rr.kg/t/topic/80107>\
**Category:** 建站\
**Tags:** 求助\
**Created:** [2026 年3 月 18 日 07:13 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107 "2026-03-18T07:13:58Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![sydney1](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/sydney1/32/34353_2.png) [@sydney1](https://2hkj2s.loc.rr.kg/u/sydney1)\
**Post date:** [2026 年3 月 19 日 07:21 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/21 "2026-03-19T07:21:12Z")

</div>

可以的，具体方法如下：  
选择免费的game server，然后环境选择other games–nodejs  
选择开免费的虽然它管理面板不支持shell，但可以通过以下方法进入shell：  
左侧栏选择文件管理，新建，粘贴以下内容：  
// shell.js  
const { spawn } = require(‘child\_process’);

// 获取通过 NODE\_ARGS 传递进来的参数  
const args = process.argv.slice(2);

console.log(“— 正在进入透明 Bash 转发模式 —”);

// 启动 bash 进程  
// 如果 args 为空，则进入交互模式；如果有参数（如 -c “ls”），则执行命令  
const shell = spawn(‘/bin/bash’, args, {  
stdio: ‘inherit’, // 关键：将 Node 的 stdin, stdout, stderr 直接绑定给 bash  
shell: true,  
env: { …process.env, TERM: ‘xterm’ } // 注入环境变量确保一些命令能正常显示颜色  
});

// 当 bash 退出时，Node 进程也同步退出  
shell.on(‘exit’, (code) =\> {  
console.log(`\n--- Bash 已退出 (退出码: ${code}) ---`);  
process.exit(code);  
});  
命名为shell.js，保存  
然后去左侧栏最底部有一个启动选项，把启动js改为shell.js  
再去终端启动，在下面的输入栏输入就能执行shell指令了，现在它就跟一个debian容器一样，允许开两个端口映射，想搭建网站或梯子都行  
还有什么问题可以回复，如果解决了你的问题就给个最佳答案吧 :ac01:

---

<div class="post-metadata">

**Author:** ![trial](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/trial/32/18265_2.png) [@trial](https://2hkj2s.loc.rr.kg/u/trial)\
**Post date:** [2026 年3 月 19 日 07:34 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/22 "2026-03-19T07:34:29Z")

</div>

不玩容器了

---

<div class="post-metadata">

**Author:** ![sydney1](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/sydney1/32/34353_2.png) [@sydney1](https://2hkj2s.loc.rr.kg/u/sydney1)\
**Post date:** [2026 年3 月 19 日 09:23 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/23 "2026-03-19T09:23:34Z")

</div>

如果不喜欢容器的端口，可以配合cloudflare代理转换端口，在cf里自定义规则就能把容器的端口转到任意的，而且这个容器连接cf速度很快

---

<div class="post-metadata">

**Author:** ![yybbtech](https://2hkj2s.loc.rr.kg/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yybbtech](https://2hkj2s.loc.rr.kg/u/yybbtech)\
**Post date:** [2026 年3 月 19 日 10:40 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/24 "2026-03-19T10:40:07Z")

</div>

甬哥的mkdir: cannot create directory ‘/etc/s-box’: Read-only file system  
老王的装上也不行全-1  
佬带带呗？教搭个节点哈，谢谢！

---

<div class="post-metadata">

**Author:** ![sydney1](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/sydney1/32/34353_2.png) [@sydney1](https://2hkj2s.loc.rr.kg/u/sydney1)\
**Post date:** [2026 年3 月 19 日 12:34 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/25 "2026-03-19T12:34:15Z")

</div>

脚本不知道，用sing-box内核二进制版本，让AI写个vless over httpupgrade的配置，然后用cloudflare转发，再用cloudflare优选（如果没用过cf也可以跳过）详细过程问AI

---

<div class="post-metadata">

**Author:** ![bashell](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/bashell/32/16890_2.png) [@bashell](https://2hkj2s.loc.rr.kg/u/bashell)\
**Post date:** [2026 年3 月 19 日 12:36 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/26 "2026-03-19T12:36:05Z")

</div>

城会玩

---

<div class="post-metadata">

**Author:** ![cs9u](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/cs9u/32/7508_2.png) [@cs9u](https://2hkj2s.loc.rr.kg/u/cs9u)\
**Post date:** [2026 年3 月 20 日 05:52 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/27 "2026-03-20T05:52:56Z")

</div>

1,other games下面没有nodejs，coding and web 下面才有node.js  
2,运行后提示 const { spawn } = require(‘child\_process’);

SyntaxError: Invalid or unexpected token  
at internalCompileFunction (node:internal/vm:128:18)  
at wrapSafe (node:internal/modules/cjs/loader:1279:20)  
at Module.\_compile (node:internal/modules/cjs/loader:1331:27)  
at Module.\_extensions..js (node:internal/modules/cjs/loader:1426:10)  
at Object.require.extensions. [as .js] (/usr/local/lib/node\_modules/ts-node/src/index.ts:1608:43)  
at Module.load (node:internal/modules/cjs/loader:1205:32)  
at Function.Module.\_load (node:internal/modules/cjs/loader:1021:12)  
at cjsLoader (node:internal/modules/esm/translators:366:17)  
at ModuleWrap. (node:internal/modules/esm/translators:315:7)  
at ModuleJob.run (node:internal/modules/esm/module\_job:222:25)  
root@rustix~ Server marked as offline

---

<div class="post-metadata">

**Author:** ![linying23333](https://2hkj2s.loc.rr.kg/letter_avatar_proxy/v4/letter/l/f14d63/32.png) [@linying23333](https://2hkj2s.loc.rr.kg/u/linying23333)\
**Post date:** [2026 年3 月 20 日 06:03 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/28 "2026-03-20T06:03:00Z")

</div>

> [@cs9u](#):
>
> 运行后提示 const { spawn } = require(‘child\_process’);
> 
> SyntaxError: Invalid or unexpected token  
> at internalCompileFunction (node:internal/vm:128:18)  
> at wrapSafe (node:internal/modules/cjs/loader:1279:20)  
> at Module.\_compile (node:internal/modules/cjs/loader:1331:27)  
> at Module.\_extensions..js (node:internal/modules/cjs/loader:1426:10)  
> at Object.require.extensions. [as .js] (/usr/local/lib/node\_modules/ts-node/src/index.ts:1608:43)  
> at Module.load (node:internal/modules/cjs/loader:1205:32)  
> at Function.Module.\_load (node:internal/modules/cjs/loader:1021:12)  
> at cjsLoader (node:internal/modules/esm/translators:366:17)  
> at ModuleWrap. (node:internal/modules/esm/translators:315:7)  
> at ModuleJob.run (node:internal/modules/esm/module\_job:222:25)

这人给的代码偷懒没放代码块里你也没改吗?

```js
const { exec, spawn } = require('child_process');
const http = require('http');

// 优先读取面板提供的环境变量，若无则默认
const HOST = process.env.SERVER_HOST || "0.0.0.0";
const PORT = process.env.SERVER_PORT || 8080;

console.log("[INFO] Starting Web Terminal Server...");
/**
 * 启动交互式 Bash 并接管面板的标准流
 */
const shell = spawn('bash', ['-i'], {
    stdio: 'inherit', // 直接将输入输出对接到面板控制台
    shell: true,
    env: { 
        ...process.env, 
        TERM: 'xterm-256color', 
        HOME: '/home/container',
        LANG: 'C.UTF-8',
        TZ: 'GMT-8',
        timezone: 'Asia/Taipei'
    }
});
// 监听退出，防止进程静默挂掉
shell.on('exit', (code) => {
    console.log(`\n[CARSH] Shell Exit End, Code: ${code}`);
    process.exit(code);
});

// 创建服务
const server = http.createServer((req, res) => {
    // 设置响应头，支持中文输出
    res.setHeader('Content-Type', 'text/plain; charset=utf-8');

    if (req.method === 'POST') {
        let body = '';
        
        // 接收 POST 数据流
        req.on('data', chunk => {
            body += chunk.toString();
        });

        req.on('end', () => {
            if (!body) {
                return res.end('Error: Empty command body');
            }

            // 执行从 Body 传入的命令
            exec(body, (err, stdout, stderr) => {
                // 合并输出结果
                const output = stdout || '';
                const error = stderr || (err ? err.message : '');
                res.end(output + error);
            });
        });
    } else {
        res.statusCode = 405;
        res.end('Please use POST method to send commands in the request body.');
    }
});
// 监听端口
server.listen(PORT, HOST, () => {
    console.log(`[INFO] Web Terminal Server running on ${HOST}:${PORT}`);
});

```

两种执行方式

1. 直接在面板执行shell命令
2. 用curl远程执行

```bash
curl -X POST http://f1.rustix.me:<上面打印的端口号> -d '这里面放命令'

```

完整示例

```bash
curl -X POST http://f1.rustix.me:12345 -d 'pwd'

```

(当然,这个远程执行的实现是不安全的.既不鉴权又用http.不过拿来方便一下部署还是可以的,部署完了拆掉远程shell.)

---

<div class="post-metadata">

**Author:** ![sydney1](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/sydney1/32/34353_2.png) [@sydney1](https://2hkj2s.loc.rr.kg/u/sydney1)\
**Post date:** [2026 年3 月 20 日 06:19 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/29 "2026-03-20T06:19:35Z")

</div>

对，记错了QAQ  
代码是

```js
// shell.js
const { spawn } = require('child_process');

// 获取通过 NODE_ARGS 传递进来的参数
const args = process.argv.slice(2);

console.log("--- 正在进入透明 Bash 转发模式 ---");

// 启动 bash 进程
// 如果 args 为空，则进入交互模式；如果有参数（如 -c "ls"），则执行命令
const shell = spawn('/bin/bash', args, {
    stdio: 'inherit', // 关键：将 Node 的 stdin, stdout, stderr 直接绑定给 bash
    shell: true,
    env: { ...process.env, TERM: 'xterm' } // 注入环境变量确保一些命令能正常显示颜色
});

// 当 bash 退出时，Node 进程也同步退出
shell.on('exit', (code) => {
    console.log(`\n--- Bash 已退出 (退出码: ${code}) ---`);
    process.exit(code);
});

```

这样是在管理面板中连接的，安全

---

<div class="post-metadata">

**Author:** ![cs9u](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/cs9u/32/7508_2.png) [@cs9u](https://2hkj2s.loc.rr.kg/u/cs9u)\
**Post date:** [2026 年3 月 20 日 06:35 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/30 "2026-03-20T06:35:07Z")

</div>

我用node.js容量，ai写了shell.js，运行目录下的index.html建了一个http 服务器。选择运行起来了。

---

<div class="post-metadata">

**Author:** ![cs9u](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/cs9u/32/7508_2.png) [@cs9u](https://2hkj2s.loc.rr.kg/u/cs9u)\
**Post date:** [2026 年3 月 20 日 06:35 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/31 "2026-03-20T06:35:48Z")

</div>

我用node.js容器，ai写了shell.js，运行目录下的index.html建了一个http 服务器。选择运行起来了。

---

<div class="post-metadata">

**Author:** ![linying23333](https://2hkj2s.loc.rr.kg/letter_avatar_proxy/v4/letter/l/f14d63/32.png) [@linying23333](https://2hkj2s.loc.rr.kg/u/linying23333)\
**Post date:** [2026 年3 月 20 日 06:38 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/32 "2026-03-20T06:38:00Z")

</div>

你随便, 反正记得没有特权就行. 不能apt装软件, 要用得静态编译

---

<div class="post-metadata">

**Author:** ![sydney1](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/sydney1/32/34353_2.png) [@sydney1](https://2hkj2s.loc.rr.kg/u/sydney1)\
**Post date:** [2026 年3 月 20 日 06:40 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/33 "2026-03-20T06:40:14Z")

</div>

可以的，下一步可以考虑用不用cf加速

---

<div class="post-metadata">

**Author:** ![cs9u](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/cs9u/32/7508_2.png) [@cs9u](https://2hkj2s.loc.rr.kg/u/cs9u)\
**Post date:** [2026 年3 月 20 日 06:53 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/34 "2026-03-20T06:53:23Z")

</div>

你晓得这家可以自定义自己的域名不？

---

<div class="post-metadata">

**Author:** ![sydney1](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/sydney1/32/34353_2.png) [@sydney1](https://2hkj2s.loc.rr.kg/u/sydney1)\
**Post date:** [2026 年3 月 20 日 06:55 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/35 "2026-03-20T06:55:07Z")

</div>

你给自己的域名设CNAME或ALIAS记录为它的域名就行

---

<div class="post-metadata">

**Author:** ![semilas](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/semilas/32/34157_2.png) [@semilas](https://2hkj2s.loc.rr.kg/u/semilas)\
**Post date:** [2026 年3 月 20 日 07:01 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/36 "2026-03-20T07:01:46Z")

</div>

之前用ai写了半天代码也跑不起来服务，晚上回去试试大佬发的脚本

---

<div class="post-metadata">

**Author:** ![Serendipity1](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/serendipity1/32/17772_2.png) [@Serendipity1](https://2hkj2s.loc.rr.kg/u/Serendipity1)\
**Post date:** [2026 年3 月 20 日 07:13 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/37 "2026-03-20T07:13:41Z")

</div>

奈斯

---

<div class="post-metadata">

**Author:** ![bashell](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/bashell/32/16890_2.png) [@bashell](https://2hkj2s.loc.rr.kg/u/bashell)\
**Post date:** [2026 年3 月 20 日 08:38 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/38 "2026-03-20T08:38:59Z")

</div>

> [@yybbtech](#):
>
> 甬哥的mkdir: cannot create directory ‘/etc/s-box’: Read-only file system  
> 老王的装上也不行全-1  
> 佬带带呗？教搭个节点哈，谢谢！

请教甬哥和老王的脚本GitHub地址

---

<div class="post-metadata">

**Author:** ![yybbtech](https://2hkj2s.loc.rr.kg/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yybbtech](https://2hkj2s.loc.rr.kg/u/yybbtech)\
**Post date:** [2026 年3 月 20 日 09:53 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/39 "2026-03-20T09:53:37Z")

</div>

大佬求指教哇！！~启动文件发我下呗！感谢！  
[6250109@qq.com](mailto:6250109@qq.com)

---

<div class="post-metadata">

**Author:** ![cs9u](https://2hkj2s.loc.rr.kg/user_avatar/2hkj2s.loc.rr.kg/cs9u/32/7508_2.png) [@cs9u](https://2hkj2s.loc.rr.kg/u/cs9u)\
**Post date:** [2026 年3 月 21 日 00:43 UTC](https://2hkj2s.loc.rr.kg/t/topic/80107/40 "2026-03-21T00:43:06Z")

</div>

已发邮件

[上一页](https://2hkj2s.loc.rr.kg/t/topic/80107.md?page=1)

[下一页](https://2hkj2s.loc.rr.kg/t/topic/80107.md?page=3)
