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

相关推荐
SPC的存折2 小时前
4、Docker私有仓库
运维·docker·容器
开开心心_Every2 小时前
扫描软件,部分文档文字表格识别功能可免费
运维·服务器·pdf·电脑·excel·3dsmax·houdini
陆伟峰(云固件作者)2 小时前
Linux Mint 22.3:给初学者的第一份 Linux 说明书
linux·运维·服务器
无忧智库2 小时前
从数据孤岛到全球实时协同:某跨国企业 Data Fabric 供应链数据编织平台全解析(WORD)
运维·fabric
齐潇宇2 小时前
Docker概述与安装
linux·运维·docker·容器
Dragon水魅3 小时前
爬虫技术详解:从传统爬虫到浏览器自动化——以豆瓣读书笔记为例
运维·爬虫·自动化
willhuo3 小时前
# 自动化数据采集技术研究与实现:基于Playwright的抖音网页自动化方案
运维·selenium·c#·自动化·chrome devtools·webview
IP老炮不瞎唠3 小时前
IP轮换机制解析:动态住宅代理如何维持高可用率?
运维·服务器·网络
一个扣子3 小时前
OpenClaw 运维完全手册|日志分析、实时监控与故障排查指南
运维·监控·故障排查·健康检查·openclaw·clawmetry·openclawdoctor