Secure connection between device and web server

Hello guys,

I did an apache2 web server and exposed the conf file inside.
The big Advantage is taht the information about influx (telegraf.conf) is hidden for all.

But the security problem is, sorry for my newbie skill security, the protection of the file.
Telegraf doesn’t accept to load a configuration from a https connection so, i did a virtualhost http with secrets (http://user:password@ip/telegraf.conf) and its works, but in windows, in the telegraf service, i can see the url with user and password.

Do you know a thing to more secure all of that ?

Best regards,

Yoann