Nginx SSL + Websocket example configuration

Luke Crooks7 years ago

I found an old thread with a few different configurations, if it helps anyone, here is a working SSL configuration for nginx + traccar + websockets:

Replace 10.1.1.1:8082 with the location of your traccar server and replace the paths to the SSL files.

This setup will listen on port 80 and forward all non SSL traffic, to the SSL interface.

[object Object]
NaGA3 years ago

Hi,

I have try to configure ssl by follow your configure but it still not working so, could you share me how this configure will match with entry key on traccar configuration?

Best Regards,
Kimseng

Luke Crooks3 years ago

What entry key configuration? With this configuration you run traccar as HTTP, then create HTTPS with nginx.

NaGA3 years ago

Hi here is my configuration on traccar and ssl

vi /opt/traccar/conf/traccar.xml

[object Object]

And I have follow your configure /etc/nginx/sites-available/myserver.com

[object Object]

My traccar location is /opt/traccar

Noted: According to both my configuration when i open via browser example myserver.com then it redirect to traccar path but can you guide me how to access by default port number of my traccar like https://myserver.com:8082?

I have try to change port from 443 to 8082 and try to access via web browser but can't access via https://myserver.com:8082

[object Object]

Best Regards,
NaGa

Luke Crooks3 years ago

You can just navigate to https://myserver.com, you don't need the port specified.

Or are you saying you want to navigate to https://myserver.com on a custom port?

[object Object]

Then change the bottom server block to

[object Object]
NaGA3 years ago

Hello,

I have try to change below. It still the same so when i access via ip i need to using port 8082 but via domain still not working with port mean it still redirect to traccar path.

[object Object]

One more just want to confirm with your that the IP address is replace by my server IP right?

[object Object]
NaGA3 years ago

I found the issue so when follow your configuration it show the error below

  • Configuration
[object Object]
  • problem with listen 8082 ssl;
[object Object]
NaGA3 years ago

Question: are you saying you want to navigate to https://myserver.com on a custom port?
Answer: i need to access with customer port https://myserver.com:8082

Anton Tananaev3 years ago

You can't have both nginx and Traccar using the same ports, of course. If you want HTTPS to be on port 8082, then you need to change Traccar port.

NaGA3 years ago

Hi,

Oh currently my traccar using port 8082 and my nginx using port 80. What i want when i open web browser i want to access to my traccar https://myserver.com:8082.

Noted: current access via IP is correct https://1.1.1.1:8082 but via domain not working