Created
March 28, 2026 19:39
-
-
Save Tech500/92a6913ced3e5c8999321dd096cd7f65 to your computer and use it in GitHub Desktop.
Mosquitto configuration files -- /etc/mosquitto/mosquitto.conf and /etc/mosquitto/conf.d/connect.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Custom Mosquitto Configuration | |
| # /etc/mosquitto/conf.d/connect.conf | |
| # | |
| # Stored in conf.d to survive package updates | |
| # DO NOT duplicate pid_file or include_dir here | |
| # ----------------------------------------------- | |
| # Per listener security settings | |
| # ----------------------------------------------- | |
| per_listener_settings true | |
| # ----------------------------------------------- | |
| # Persistence | |
| # ----------------------------------------------- | |
| persistence true | |
| persistence_location /var/lib/mosquitto/ | |
| # ----------------------------------------------- | |
| # Logging | |
| # ----------------------------------------------- | |
| log_dest file /var/log/mosquitto/mosquitto.log | |
| log_type error | |
| log_type warning | |
| log_type notice | |
| log_type information | |
| # ----------------------------------------------- | |
| # Listener block - keep settings together | |
| # ----------------------------------------------- | |
| listener 1883 | |
| bind_address 0.0.0.0 | |
| allow_anonymous false | |
| password_file /etc/mosquitto/passwd | |
| _________________________________________________________________________________ | |
| Key Rules Followed: | |
| Setting | |
| Location | |
| Reason | |
| pid_file | |
| mosquitto.conf only | |
| One instance only | |
| include_dir | |
| mosquitto.conf only | |
| No recursive loop | |
| Listener settings | |
| connect.conf | |
| Safe from updates | |
| Persistence | |
| connect.conf | |
| Safe from updates | |
| Logging | |
| connect.conf | |
| Safe from updates | |
| Test Before Running: | |
| _________________________________________________________________________________ | |
| bash | |
| # Test configuration | |
| sudo mosquitto -c /etc/mosquitto/mosquitto.conf --test-config | |
| # Expected clean output | |
| # No errors = ready to go | |
| # Restart broker | |
| sudo systemctl restart mosquitto | |
| # Verify running | |
| sudo systemctl status mosquitto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sure! Here’s a clean complete example based on what we saw in Charles’s setup tonight: | |
| /etc/mosquitto/mosquitto.conf 03/26/2026 Claude (Anthropic AI) | |
| # Mosquitto Configuration File | |
| # /etc/mosquitto/mosquitto.conf | |
| # | |
| # Managed by package updates - keep custom config in conf.d/ | |
| # Full documentation at /usr/share/doc/mosquitto/examples/mosquitto.conf | |
| # ----------------------------------------------- | |
| # Core broker settings - keep here, not in conf.d | |
| # ----------------------------------------------- | |
| pid_file /run/mosquitto/mosquitto.pid | |
| # Pull in custom configuration files | |
| include_dir /etc/mosquitto/conf.d | |
| /etc/mosquitto/conf.d/connect.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment