Question
I would like to deploy traccar for my cPanel server. Is there a way I can do this?
Answer
Traccar is a Java-based application and while this can be installed and loaded, cPanel is unable to offer in-depth support for this. We do recommend reviewing their installation guide for this at Traccar Installation.
If you want to proxy a domain to the service, you can do this by adding a proxy pass configuration to your Apache configuration so this loads through a standard 80 and 443 port. Please note AutoSSL will not acquire an SSL with the proxy in place. You must acquire the SSL before making this custom configuration.
To proxy this, please review their secure-connection guide at Secure-Connection.
By setting up a 'traccar' subdomain for the domain we want to use, the following allows access over port 80 and automatically redirects this to HTTPS. Replace $subdomain in this case with the subdomain you want, or if you want it on the main domain, exclude the subdomain.
/etc/apache2/conf.d/userdata/std/2_4/$username/$subdomain.$domain.tld
ProxyPass /api/socket ws://127.0.0.1:8082/api/socket
ProxyPassReverse /api/socket ws://127.0.0.1:8082/api/socket
ProxyPass / http://127.0.0.1:8082/
ProxyPassReverse / http://127.0.0.1:8082/
ProxyPassReverseCookiePath / /$subdomain/
Redirect permanent /$subdomain /$subdomain/
To simply redirect to the SSL version instead, use:
ServerName $subdomain.$primarydomain.tld
Redirect / https://$subdomain.$primarydomain.tld
For the SSL version,
/etc/apache2/conf.d/userdata/sssl/2_4/$username/$subdomain.$domain.com
SSLEngine on
SSLCertificateFile /var/cpanel/ssl/apache_tls/$subdomain.$domain.tld/combined
SSLUseStapling off
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
ProxyPass /api/socket ws://127.0.0.1:8082/api/socket
ProxyPassReverse /api/socket ws://127.0.0.1:8082/api/socket
ProxyPass / http://127.0.0.1:8082/
ProxyPassReverse / http://127.0.0.1:8082/
Redirect permanent /$subdomain /$subdomain/
Finally restart your service. /scripts/restartsrv_httpd
The domain should now be able to load the traccar through the standard 443 port.
Comments
0 comments
Article is closed for comments.