반응형
콘솔에서 아래 명령으로 실행을 해서 모든 설정을 테스트 완료하고 나면
cloudflared tunnel run home_server ## 이 명령은 터미널이 닫히고나면 프로세스가 종료됨
그래서 서비스로 등록해주기 위해 아래와 같이 실행
sudo cloudflared service install
터미널을 닫으면 cloudflared 프로세스가 끝나기 때문에
항상 Mac OS 시스템에서 실행될 수 있도록 서비스로 실행해줘야 한다.
cloudflared tunnel info <<my_home_server>>
Your tunnel <<my_home_server>> does not have any active connection.
* 위와 같이 does not have any active connenction 나오면 제대로 실행이 되지 않은 것
~/.cloudflared/config.yml 및 json 파일을 제대로 로딩하지 못했기 때문일 가능성이 크다.
### 해결방법
* 기존 launchd 서비스 제거
brew services stop cloudflared
brew services cleanup
* cloudflared 터널용 launchd 서비스 파일 수정
sudo vi /Library/LaunchDaemons/com.cloudflare.cloudflared.plist
<key>Label</key>
<string>com.cloudflare.cloudflared</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/cloudflared</string>
<string>--config</string>
<string>/Users/<<USER_ACCOUNT>>/.cloudflared/config.yml</string>
<string>tunnel</string>
<string>run</string>
<string><<MY_TUNNEL_NAME_OR_ID>></string>
</array>
* clean up 및 서비스 로드
#기존 서비스 unload
sudo launchctl unload /Library/LaunchDaemons/com.cloudflare.cloudflared.plist
#서비스 load
sudo launchctl load -w /Library/LaunchDaemons/com.cloudflare.cloudflared.plist
sudo cloudflared service uninstall
sudo cloudflared service install
sudo launchctl load -w /Library/LaunchDaemons/com.cloudflare.cloudflared.plist
sudo launchctl start com.cloudflare.cloudflared
(*설명에는 install시에 plist 에 yml 위치를 읽어서 실행시킨다고 되어있는데 mac 에서는 이부분이 잘 안되면 위와같이 plist 에 명시적으로 입력해서 해결)
반응형
'Tech > Mac OS 홈서버' 카테고리의 다른 글
| Cloudflare zero trust 홈서버(ssh, n8n, code) 보안 설정 (0) | 2025.11.20 |
|---|---|
| 홈서버 보안 : 공유기 포트포워딩 + 서비스 방식의 위험성 (0) | 2025.11.20 |
| cloudflare 에서 도메인 연결하기(Onboard a domain) (0) | 2025.11.20 |
| 홈서버 셀프호스팅용, 도메인 싸게 구입하기 (0) | 2025.11.20 |
| Mac OS 맥미니 m1 서버만들기 (지난번 글을 보기 편하게 md포매팅) (0) | 2025.11.18 |
