如何配置nginx转发到ttyd的7681的端口上
假设ttyd已经在服务器上安装并且正在运行,以下是配置nginx转发到ttyd的7681端口的步骤:
-
打开nginx的配置文件,通常在/etc/nginx/nginx.conf或者/etc/nginx/conf.d/default.conf中。
-
在http部分中添加以下配置:
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://127.0.0.1:7681/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
- 保存配置文件并重启nginx服务。
现在,当用户访问yourdomain.com时,nginx会将请求转发到ttyd的7681端口上。注意,如果你使用的是HTTPS,需要将listen 80改为listen 443,并添加SSL证书相关的配置
原文地址: https://www.cveoy.top/t/topic/fIqU 著作权归作者所有。请勿转载和采集!