modern folders

ubitec2 years ago

good morning, is it possible to have 2 (or more) different modern folders (ie 2 different web-apps) on the same server? How would I access each one? assuming one is modern and the other modern2

Cristian2 years ago

what has been said is that you can have 2 different instances of traccar on the same machine, which is certainly possible see this link
https://www.traccar.org/forums/topic/install-traccar-to-a-folder-different-from-opttraccar/
The only thing I can add is that your server must have good resources because in my case it got slow running 2 instances of traccar.

ubitec2 years ago

I saw it, but I don't want 2 instances of traccar, I want 2 web-apps, that is, only 2 accesses to the same server and database, for example, how the legacy and modern folders were in previous versions, but with 2 modern versions is the question or only 2 different login pages

Anton Tananaev2 years ago

I think the question is about two web apps connected to the same Traccar instance.

It is possible to have multiple web apps through a proxy. For example, you can configure Apache virtual hosts to serve different apps based on a domain name.

ubitec2 years ago

Thanks Anton, in that case, what would be the file to point to? For example, it would be opt/traccar/modern/index,html? and in case 2 opt/traccar/modern2/index.html?

Anton Tananaev2 years ago

The folder doesn't matter. You need to point Apache to whatever folders you're using. The key is to proxy the /api path to Traccar.

ubitec2 years ago

ok, now I know where to try, thank you very much

gustavofarias2 years ago

The fact the traccar.conf has only one "web.path" doesn't matter? We can leave it pointing to one of the folders?

gustavofarias2 years ago

The example in here: https://www.traccar.org/secure-connection/

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerName demo.traccar.org
                ServerAdmin webmaster@localhost

                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/

                SSLEngine on
                SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
                SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
        </VirtualHost>
</IfModule>

DocumentRoot points to a folder where there is no Traccar app, but still it works when you access demo.traccar.org

If I create a second virtual host on a subdomain say demo2.traccar.org how can I make each one point to specific app folder? I ask because this DocumentRoot seems to be ignored, so how can a second virtualHost be different from the first?

Anton Tananaev2 years ago

DocumentRoot is ignored in this case because we're proxying everything. You obviously need to set it up so that Apache is serving the app files and only API is proxied.

gustavofarias2 years ago

There is nothing obvious to me. I don't know why Traccar needs this VirtualHost thing and what it does. I just do it because I want Traccar to run over SSL and I follow documentation.

In an exercise of pure guessing I tried:

DocumentRoot /opt/traccar/legacy

ProxyPass /api/socket ws://localhost:8082/api/socket
ProxyPassReverse /api/socket ws://localhost:8082/api/socket

# ProxyPass / http://localhost:8082/
# ProxyPassReverse / http://localhost:8082/

In this example I'm trying to override the default behavior and force the legacy app although web.path is pointing to the modern app.
I get 403 Forbidden. Note: Apache is able to access the files.
DocumentRoot /opt/traccar/modern has the same result.