I’m running a webapp consisting out of several tomcat8 servlets. Above that configuration, nginx runs as a reverse proxy. Now i want to use piwik to gain some statistics about my webapp but i’m really struggling setting it up in nginx. I followed this tutorial, since it was the most up-to-date i found: How to Install Piwik with Nginx on Ubuntu 15.10
What i really don’t understand is how to configure the url mapping for piwik so that i can access it through the browser. The mapping for my webapps is as follows:
mysite.com -> https:/ localhost:8080/app1
mysite.com/app2 -> https://localhost:8080/app2
mysite.com/app3 -> https://localhost:8080/app3
This is how this mapping is defined in the “sites-enabled” config file:
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
server_name mysite.com;
ssl on;
ssl_certificate "..."
ssl_certificate_key "..."
ssl_prefer_server_ciphers on;
ssl_protocols "..."
ssl_ciphers "..."
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8080/app1/;
proxy_read_timeout 90;
}
location /app2 {
...
}
...
}
All my apps are in tomcat8/webapps directory, but piwik is installed in /var/www/piwik (see Tut above). Like in the tutorial i have created a new config file “mysite.com.config”, but it is not working with the domain mysite.com.
So how do i have configure nginx so that i can access piwik via www.mysite.com/piwik
?