nodered 如何升级https 访问
时间: 2024-05-11 22:15:24 浏览: 77
Red_Hat_Enterprise_Linux-8-8.4_Release_Notes-zh-CN.pdf
您可以通过运行以下命令在Node-RED中实现https访问升级:
```
sudo nano /etc/nginx/sites-available/default
```
在配置文件中添加以下行,替换YOUR_DOMAIN_HERE和YOUR_EMAIL_HERE以更改为您自己的值:
```
server {
listen 80;
server_name YOUR_DOMAIN_HERE;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name YOUR_DOMAIN_HERE;
ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN_HERE/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN_HERE/privkey.pem;
location / {
proxy_pass http://127.0.0.1:1880;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
然后,运行以下命令来安装Let's Encrypt SSL证书:
```
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot --nginx -d YOUR_DOMAIN_HERE -m YOUR_EMAIL_HERE --redirect --agree-tos --no-eff-email
```
这将在您的服务器上安装运行Nginx,并自动设置https访问。
阅读全文