screego 安装配置教程 作者:马育民 • 2024-09-09 08:51 • 阅读:10010 生成 HTTPS 证书 执行以下命令生成密钥 server.key,过程中会要求设置密码,按提示输入即可。 [root@localhost screego-demo]# openssl genrsa -des3 -out server.key 2048 1 接下来执行以下命令去除刚刚设置的密码: [root@localhost screego-demo]# openssl rsa -in server.key -out server.key 1 为什么要去除密码呢?我测试过配置带有密码的密钥,结果服务无法正常启动,提示如下: FTL http server error="tls: failed to parse private key" 1 使用密钥创建服务器证书的申请文件 server.csr,过程中会要求输入一些信息,不填也可。 [root@localhost screego-demo]# openssl req -new -key server.key -out server.csr 1 创建 CA 证书 ca.crt: [root@localhost screego-demo]# openssl req -new -x509 -key server.key -out ca.crt -days 3650 1 创建服务器证书 server.crt: [root@localhost screego-demo]# openssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey server.key -CAcreateserial -out server.crt 1 目前目录文件如下: screego-demo ├── ca.crt ├── ca.srl ├── LICENSE ├── README.md ├── screego ├── screego.config ├── server.crt ├── server.csr └── server.key 1 2 3 4 5 6 7 8 9 10 密钥 server.key 和服务器证书 server.crt 已经创建,接下来就可以修改配置了。 修改配置 编辑配置文件 screego.config,这里仅列出我修改的配置项。 SCREEGO_EXTERNAL_IP=192.168.128.128 SCREEGO_SERVER_TLS=true SCREEGO_TLS_CERT_FILE=/root/screego-demo/server.crt SCREEGO_TLS_KEY_FILE=/root/screego-demo/server.key 1 2 3 4 说明: SCREEGO_EXTERNAL_IP:访问地址,配置服务器的 IP 地址,以实际为准。 SCREEGO_SERVER_TLS:TLS 开关。由于之前已配置了 HTTPS 的证书,这里改为 true。 SCREEGO_TLS_CERT_FILE:指定证书。 SCREEGO_TLS_KEY_FILE:指定密钥。 修改以上配置项后,服务就可以启动了。如果需要了解更多细节,可以查阅官方文档 [2] 获取帮助。 启动 运行以下命令启动 screego: root@localhost screego-demo]# ./screego serve 1 没有报错的话,访问 https://192.168.128.128:5050 就可以看到建房页面了,如下图所示。这里的 IP 是我虚拟机的地址,大家以自己实际配置的为准。 ———————————————— 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 原文链接:https://blog.csdn.net/jiangyou0k/article/details/109508809 原文出处:http://malaoshi.top/show_1IX8OSymmvCx.html