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

相关推荐
吴声子夜歌5 分钟前
Nginx应用与运维——Nginx在Kubernetes中的应用(一)
运维·nginx·kubernetes
苏三的开发日记31 分钟前
百度网盘p2p加速文件存储位置修改记录
运维
LabVIEW开发1 小时前
Anritsu 2602A:频谱仪的几种测量怎么自动跑
运维·服务器·labview·labview知识·labview功能·labview程序
2401_868534781 小时前
存储系统规划设计
运维·服务器·智能路由器
螺蛳粉 螺蛳粉1 小时前
第一篇:Keepalived 高可用实战:VIP 漂移与 Nginx 主备切换完整指南
运维·nginx·负载均衡·keepalived·高可用
荣合技术服务1 小时前
VMware ESXi 虚拟化平台服务器虚拟机数据恢复服务
linux·运维·服务器
爱吃香菜的初学者1 小时前
十三.Linux——信号量
linux·运维·服务器·开发语言
吴声子夜歌2 小时前
Nginx应用与运维——Nginx在Kubernetes中的应用(三)
运维·nginx·kubernetes
灯澜忆梦2 小时前
【minio】#5 | MinIO 分布式部署 + HTTPS 部署
分布式·网络协议·https·对象存储·minio
小小龙学IT2 小时前
ROS2 安装完全指南(Ubuntu 版):从零开始到跑通第一个节点本文
linux·运维·ubuntu