Followed readme but no SSL

Kleent5 years ago

Hi,
I have setup Traccar on DigitalOcean following the readme guides.
However, i could not get it to display HTTP/HTTPS after implementing the Secure Connection recommendations.
The "stock" installation (http) will display Traccar login page.
So far i have tried various configurations to no avail : changing the apache listening port from 80 to 8989 (/etc/apache2/ports.conf) | generated self-signed certificates to replace the defaults..
My current configuration (with self-signed certificates) will display the default apache landing page if access the site using HTTP and throws error 503 with HTTPS.

I have put the logs on privatebin.net in case someone is willing to read and maybe find out what im doing wrong.
In advance thank you for your input.

Anton Tananaev5 years ago

Seems like you have some port conflicts.

Kleent5 years ago

Thanks for the input.
If you are referring to the last line of the /opt/traccar/logs/tracker-server.log, its the current config along with the rest; whereby i didn't change apache's listening port, thus leaving it as default.
However, i still encounter the same [Connection refused: AH00957] even if i change the listening port from apache.
Maybe i ought to do something extra on top of changing the said listening port ?
I skimmed a good chunk of the forum page-by-page, in search for a similar thread that could point to the solution with no luck so far.

Thanks Anton

Anton Tananaev5 years ago

Why are you changing any ports?

Kleent5 years ago

As i could not the login page to display in HTTPS, i thought maybe a port conflict could be the origin, so i tried setting another listening port of apache by amending /etc/apache2/ports.conf.

But as that also didn't yield the expected result, i reversed the change as seen from the posted logs.

Anton Tananaev5 years ago

Your log clearly shows that Traccar is not listening on any port. How did you fix that part? I don't see any evidence that it's fixed.

Kleent5 years ago

Thanks for pointing that out Anton.
I didn't claimed i fixed the issue as i even don't know what it was.
I will try to fix that and keep you posted.
Again, thank you for your guidance.

Anton Tananaev5 years ago

Well, you have to fix the issue first. As far as I can see, there was a port conflict and Traccar is not listening on the port, so obviously nothing works.

Anders Yuran5 years ago

I dont know the difference but I have 3 different backend servers proxied with apache and I have no problems to set it up

All my configs looks the same only port is different

My config

ProxyPass /api/socket ws://localhost:8082/api/socket
ProxyPassReverse /api/socket ws://localhost:8082/api/socket
ProxyPass / http://localhost:8082/
ProxyPassReverse / http://localhost:8082/
Kleent5 years ago

Thank you for your input Anders,

I have finally resolved the issue.
My knowledge of linux and apache for that matter is very limited, if not null; making troubleshooting very painfull.
From my newly acquired understanding of what went wrong, here is my take on the whole shebang!

  1. the stock installation of traccar works fine in http (with the web port in the traccar.xml set to 80).
    In this scenario, there is no competition for the usage of port 80; traccar service has it all for itself.
    Note that if you start traccar service before installing apahce, apache will cringe and quit after installation, throwing a warning about process ressource usage conflict

  2. when apache is installed for the purpose of using HTTPS through reverse proxy, it takes precedence for all web requests and needs to be told on what port to forward data to traccar.
    In the vhost file in the name of /etc/apache2/sites-available/traccar.conf, the configuration section for a secured connection [<VirtualHost *:443>] has the proxy forwarding to traccar on port 8082, as per the "How-To Guide".
    The [<VirtualHost *:80>] section from the same file requires a line for redirection to HTTPS; or else apache will take you to the default Ubuntu "It Works" landing page for all HTTP requests.

  3. Since apache is now handling HTTP & HTTPS, traccar is "undercut" and will not receive any request on the default web port 80 specified in /opt/traccar/conf/traccar.xml.
    The traccar web port information have to be updated to reflect the proxy port info from the vhost (traccar.conf) to thrully have apache work flowlessly.

All this seems obvious to folks acquainted with linux, but not to me. Was a learning curve.

Thanks Anton, Anders and all the readers.

Anders Yuran5 years ago

But the documentation clearly states that traccar must be proxied to handle ssl. And the normal port for traccar is 8082, not 80. If you installed and changed conf to port 80 and then installed apache I can understand why you got problem. And its a bad idea to not install apache first if you will use virtual hosts