nginx——https

SERVER_IP=你的服务器IP

sudo mkdir -p /etc/nginx/ssl

sudo openssl req -x509 -nodes -newkey rsa:2048 \

-keyout /etc/nginx/ssl/openclaw.key \

-out /etc/nginx/ssl/openclaw.crt \

-days 365 \

-subj "/CN=${SERVER_IP}" \

-addext "subjectAltName = IP:${SERVER_IP}"

sudo dnf install -y nginx

sudo tee /etc/nginx/conf.d/openclaw.conf > /dev/null <<'EOF'

server {

listen 443 ssl http2;

server_name _;

ssl_certificate /etc/nginx/ssl/openclaw.crt;

ssl_certificate_key /etc/nginx/ssl/openclaw.key;

ssl_protocols TLSv1.2 TLSv1.3;

add_header Strict-Transport-Security "max-age=31536000" always;

location / {

proxy_pass http://127.0.0.1:18789;

proxy_http_version 1.1;

proxy_set_header Host $host;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "upgrade";

proxy_set_header X-Forwarded-For $remote_addr;

proxy_set_header X-Real-IP $remote_addr;

proxy_read_timeout 3600;

proxy_send_timeout 3600;

}

}

server {

listen 80;

server_name _;

return 301 https://hostrequest_uri;

}

EOF

sudo nginx -t

sudo systemctl enable --now nginx

sudo systemctl restart nginx

相关推荐
智脑API平台4 小时前
Codex CLI 怎么用 .env 配置 API Key?本地项目和自动化脚本接入教程
运维·自动化
weixin_307779134 小时前
Linux下Docker Compose里运行的MySQL数据库故障诊断Shell脚本
linux·运维·mysql·docker·自动化
笺落彼岸4 小时前
SpringBoot3 JDK17集成proguard实现混淆打包
安全·https
流浪0015 小时前
Git篇(三):吃透远程协作:SSH 密钥、分支、标签全流程实战指南
运维·git·ssh
FoldWinCard6 小时前
D4 Linux 进程 内存 等命令
linux·运维·服务器
番茄育学园6 小时前
2026表格自动化工具实测:四个不同方案,适配不同办公场景
运维·自动化
j7~6 小时前
【Linux 系统】二十.进程间通信(共享内存、消息队列、信号量)
linux·运维·消息队列·共享内存·信号量·system v
小南家的青蛙6 小时前
使用Nginx中配置CRL
nginx·crl
裤兜里有钱7 小时前
关于Xshell连接虚拟机Linux失败的主要原因
linux·运维·服务器
有毒的教程7 小时前
Ansible批量操作自动化完整教程:批量部署服务、配置同步、软件更新实战
运维·自动化·ansible