-1

I am trying to setup the Matomo analytics on NGINX webserver running on windows OS. While the webserver seems to be running fine , i cannot get to the landing page of matomo for further completing the further configurations.

Windows 10 Php - 7.1.7

Below is the content of my nginx.conf file and the matomo contents are placed in \html\analytics folder.

server {
        listen       6680;
        server_name  localhost;


    location ~ ^/(index|matomo|piwik|js/index|plugins/HeatmapSessionRecording/configs)\.php {
        include fastcgi.conf; # if your Nginx setup doesn't come with a default fastcgi-php config, you can fetch it from https://github.com/nginx/nginx/blob/master/conf/fastcgi.conf
        try_files $fastcgi_script_name =404; # protects against CVE-2019-11043. If this line is already included in your snippets/fastcgi-php.conf you can comment it here.
        fastcgi_param HTTP_PROXY ""; # prohibit httpoxy: https://httpoxy.org/
        #fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #replace with the path to your PHP socket file
        #fastcgi_pass 127.0.0.1:9000; # uncomment if you are using PHP via TCP sockets (e.g. Docker container)
    }
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

            location /analytics {
            root   matomo;
            index  index.php;
        }
        
        #location / {
            #root   html;
            #index  index.html index.htm;
        #}
        
        


        #error_page  404              /404.html;

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

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

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

If i try to access from browser as - http://localhost:6680/analytics/ , i get a "404 forbidden" error.

Can someone please point out the correct setting needed to get this working?

Thanks.

1 Answers1

0

Have you tried using the official NGINX conf file from the github repo?

You can find it here: https://github.com/matomo-org/matomo-nginx

You will need to change some of the settings to match the correct ports for your setup since you're using a non-standard port.

You could also try using a subdomain redirect that listens of port 80 and uses proxy-pass to connect to your Matomo installation.

Starker3
  • 26
  • 1