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

相关推荐
来者皆善1 小时前
ZYNQ linux上使用 USB CDC ACM
linux·运维·服务器
4/5$全真龙门1 小时前
廉价易行的内网穿透
运维
缓慢更新2 小时前
企业档案管理系统迁移实录:从文件服务器到智能检索引擎
运维·服务器
小北的AI科技分享2 小时前
企业AI开发:从技术选型到落地的关键路径
运维·模型·评估
Dawn-bit2 小时前
Linux磁盘分区与Swap和磁盘故障查询
linux·运维·服务器·网络·云计算
netho03 小时前
影刀rpa证书题库使用教学
运维·服务器·rpa
无足鸟ICT4 小时前
【RHCA+】$[]
linux·运维·服务器
运维技术小记4 小时前
国产化环境配置 VNC 远程桌面:麒麟 V10 实战
linux·运维·服务器
giaming0235 小时前
告别Docker Desktop!一款轻量级原生开发环境管理工具:FlyEnv
运维·docker·容器