Accessing Node-RED
- 브라우저를 열고 다음 주소를 방문하세요:
https://<SERVER_IP> - 브라우저에서 SSL 경고가 표시될 수 있습니다(자체 서명 인증서).
- 인증が必要です (기본 인증 팝업)
- 인증 방식: HTTP 기본 인증
- 인증 정보는 다음 위치에 안전하게 저장됩니다:
/root/.cloudzy-creds
중요한 파일 및 디렉터리
- Main installation directory is
/root/node-red. - Docker orchestration file is
/root/node-red/docker-compose.yml. - Persistent Node-RED data is stored in
/var/lib/docker/volumes/node-red_node-red-data/_data. - Nginx configuration file is located at
/etc/nginx/sites-available/node-red. - Basic authentication credentials are stored in
/etc/nginx/auth/node-red.htpasswd. - TLS certificates are stored in
/etc/nginx/ssl.
서비스 관리
컨테이너 상태 확인:
docker ps
로그 보기:
docker compose -f /root/node-red/docker-compose.yml logs -f
Restart Node-RED:
docker compose -f /root/node-red/docker-compose.yml restart
Nginx 재시작:
systemctl restart nginx
Node-RED Admin User (Alternative to Basic Auth)
Node-RED has its own internal authentication system, which can replace HTTP Basic Auth.
1. Locate settings.js
The main configuration file is inside the Node-RED Docker volume: /var/lib/docker/volumes/node-red_node-red-data/_data/settings.js
2. Enable adminAuth
열기 settings.js and uncomment (or add) the adminAuth section. It should look something like this:
adminAuth: {
type: "credentials",
users: [
{
username: "admin",
password: "<HASHED_PASSWORD>",
permissions: "*"
}]
},
3. Generate a password hash
You can generate the hash from inside the Node-RED container:
docker exec -it node-red-node-red-1 node-red admin hash-pw
You will be prompted to enter your plain password.
Copy the resulting hash and paste it as the password value in settings.js.
4. Restart Node-RED
After editing settings.js:
docker compose -f /root/node-red/docker-compose.yml restart
5. Disable HTTP Basic Auth in Nginx (Optional)
Edit the Nginx site file: /etc/nginx/sites-available/node-red
Remove or comment out these lines:
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/auth/node-red.htpasswd;
Nginx 재시작:
systemctl restart nginx
도메인에 SSL 활성화하기
1. 도메인을 서버 IP로 연결하십시오.
2. Nginx 설정을 편집하고 둘 다 교체하십시오. server_name <IP>; 귀하의 도메인과 함께 (<your-domain>HTTP(포트 80) 및 HTTPS(포트 443) 블록 모두에 대해:
vim /etc/nginx/sites-available/node-red
3. Certbot 설치:
apt install -y certbot python3-certbot-nginx
4. 유효한 Let’s Encrypt 인증서를 생성하려면 다음 명령어를 실행하십시오:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
5. Nginx 구성에서 SSL 경로 교체:
vim /etc/apache2/sites-available/node-red
# Before:
# ssl_certificate /etc/nginx/ssl/fullchain.pem;
# ssl_certificate_key /etc/nginx/ssl/privkey.pem;
# After:
# ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
6. 변경 사항을 적용하려면 Nginx를 재시작하십시오:
systemctl restart nginx
7. 브라우저를 열고 다음 주소를 방문하세요: https://yourdomain.com