How to enable SSL for website AND traccar?

IoSonoPiero 3 years ago

Of course, Anton.
I tried to follow the instructions here: https://httpd.apache.org/docs/trunk/vhosts/examples.html

Listen 443
Listen 8082
 
<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName mysite.info
    ServerAlias www.mysite.info
    DocumentRoot /var/www/montinaro
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
 
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/mysite.info/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mysite.info/privkey.pem
</VirtualHost>
 
<VirtualHost *:8082>
    ServerAdmin webmaster@localhost
    ServerName mysite.info
    ServerAlias www.mysite.info
    DocumentRoot /var/www/html
 
    ProxyPass /api/socket ws://localhost:8082/api/socket
    ProxyPassReverse /api/socket ws://localhost:8082/api/socket
 
    ProxyPass / http://localhost:8082/
    ProxyPassReverse / http://localhost:8082/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
 
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/mysite.info/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mysite.info/privkey.pem
</VirtualHost>
</IfModule>

Sorry but I think I'm not so good with Markdown.

@Track-trace
I've not used Proxypass because I'm not able to configure it.
What you saw before is, as stated, the current configuration of conf file

Regards,
Piero

Anton Tananaev 3 years ago

Obviously this won't even start because you're trying to use the same port for Apache and Traccar. You either need to pick a new port in Apache or change port in Traccar.

IoSonoPiero 3 years ago

You are right. That was the first problem.
I've noticed that If I remove the first two lines:
Listen 443
Listen 8082

Apache starts, but the situation is the same.

I repeat, I did a lot of attempts, but I have no experience with Apache webserver, sadly.