问题
After I made changes to the mosquitto.conf file for adding TLS support, I restarted the Mosquitto Broker service but its not starting. The error says the Mosquitto Service started on Local computer and then stopped -
# MQTT over TLS
listener 8883
cafile C:Program Files (x86)mosquittocertificatesca.crt
certfile C:Program Files (x86)mosquittocertificatesserver.crt
keyfile C:Program Files (x86)mosquittocertificatesserver.key
This error also occurs when I made changes to the mosquitto.conf file-
listener 9001 0.0.0.0
protocol websockets
I am using a Windows 10 machine. Did anyone face this problem?
回答1:
As worked through in the comments.
The paths to the certificates need to have the correct path separators '\' included and as they contain spaces should be wrapped in quotes. e.g.
# MQTT over TLS
listener 8883
cafile "C:\Program Files (x86)\mosquitto\certificates\ca.crt"
certfile "C:\Program Files (x86)\mosquitto\certificates\server.crt"
keyfile "C:\Program Files (x86)\mosquitto\certificates\server.key"
Also the pre-built version of mosquitto for Windows does not include websocket support. If you need websocket support you will have to built it from the source yourself and build and include the libwebsocket dependency.
来源:https://stackoverflow.com/questions/46049035/mosquitto-service-issue-on-windows