Fresh install on a new server (Hiawatha web server) issues


(Gilad) #1

Hi all,
I’ve installed a new server just for our Matomo and it has:
Hiawatha web server (similar to NGINX but we like it better). It uses php-fpm to provide php support.
Server has ubuntu with php 7.2 and all modules installed.

I am trying to put the Matomo on the main site under /stats folder.
When I browse to the site I get the setup screen which indicates all extensions and stuff as green and correct.
When I hit next I reach the DB details which I fill out (and are correct) (URL is: /stats/index.php?action=databaseSetup&clientProtocol=https)

The issue happens when I hit “next”.
The site redirects to a url: /stats/index.php///////////////////?action=databaseSetup&clientProtocol=https
Which creates a “too many redirects” error.

Site isn’t behind a reverse proxy and I have tried with and without SSL both with the same result.

I spent hours trying to fix this but had no success so far.

Anyone has any idea how to fix this?
Are there any .htaccess or redirect rules needed for Matomo or the setup to work?

Any advice would be highly appreciated.


(Fabian Dellwing) #2

This is definitly a problem with the webserver itself and not with Matomo. For some unknown reason it thinks it needs to add / behind the index.php until redirect limit breaks it. I have no clue of the webserver, but if it follows common knowledge I might be able to spot the problem if you provide the config.


(Gilad) #3

Thanks!
I will try another machine running Nginx to make sure.


(Fabian Dellwing) #4

Here my working nginx config:

server {
        listen       80;
        server_name  stats.promato.de;
        access_log  /var/log/nginx/piwik-access.log combined;
        error_log /var/log/nginx/piwik-error.log;
        root /var/www/piwik;
        index index.php index.html;
        expires max;

        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   /usr/share/nginx/html;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9001
        location ~ \.php$ {
                fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
                fastcgi_pass   unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param HTTP_PROXY "";
                include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        location ~ /\.ht {
                deny  all;
        }

        location ^~ /.well-known {
                allow all;
                default_type "text/plain";
        }


	listen 443 ssl; # managed by Certbot
	ssl_certificate /etc/letsencrypt/live/stats.promato.de/fullchain.pem; # managed by Certbot
	ssl_certificate_key /etc/letsencrypt/live/stats.promato.de/privkey.pem; # managed by Certbot
	include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
	ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


	if ($scheme != "https") {
	    return 301 https://$host$request_uri;
	} # managed by Certbot

	if ($bad_referer) {
	    return 444;
	}
}

(Gilad) #5

Thanks a lot! Will give it a try