Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why override a lot of existing nginx files??? #27

Closed
flip111 opened this issue Nov 8, 2015 · 11 comments · Fixed by #43
Closed

Why override a lot of existing nginx files??? #27

flip111 opened this issue Nov 8, 2015 · 11 comments · Fixed by #43

Comments

@flip111
Copy link

flip111 commented Nov 8, 2015

git clone https://github.com/perusio/piwik-nginx.git /etc/nginx

seems a bit crazy to advice to replace the current nginx.conf with the one from the repo just like that ...

yes ok you make a backup with nginx.old which should then be deleted later on??

Is there a configuration available that concentrate on just making piwik work and not mess around with all the fastcgi configuration and other not directly related piwik configs ??

@perusio
Copy link
Collaborator

perusio commented Nov 9, 2015

Yes you shoulf backup your old nginx directory.

mv /etc/nginx /etc/nginx.old

I fail to see how FCGI is unrelated to piwik, you'll have to deal with it. It's how PHP communicates with nginx.

@flip111
Copy link
Author

flip111 commented Nov 9, 2015

everything in the universe is related ... but piwik can run just as well on one worker_process than 4

https://github.com/perusio/piwik-nginx/blob/master/nginx.conf#L3

just to give you another example ...

Just my opinion the configuration should limit itself to the absolute neccesities, further can make recommendations but not enforce/override them.

How will i know which setting is absolutely neccesary for piwik to run?

@ttiurani
Copy link

ttiurani commented May 6, 2016

This is my problem as well. From the configuration in this repository, it's really hard to find out what is actually needed to run Piwik under a subpath e.g. "example.com/piwik/index.php". Piwik isn't the only software that Nginx is proxying on my machine, so I'd just prefer to have one "/etc/nginx/sites-available/piwik.nginx.conf" file, alongside other service configuration files.

Did you @flip111 manage to create a simple Piwik configuration?

@flip111
Copy link
Author

flip111 commented May 6, 2016

@ttiurani no sorry, my piwik installation is broken ever since this post (and before) and did not get around to fixing it ...

@anupamapanchal
Copy link

I have multiple website behind my nginx server and cloning the whole nginx folder and getting rid of the existing settings is lot more problematic. I agree with @flip111 that first provide us minimum configuration for running it on nginx and then this can be used for advance. Currently I am stuck with the installation and not able to find get arounds.

@xenithorb
Copy link

@anupamapanchal Here's a flat file I pieced together - https://gist.github.com/xenithorb/aa4252d1a43dc7c6660091df6189a948

@mattab
Copy link
Member

mattab commented Oct 19, 2017

Hi everyone, if anyone is interested please see my other issue: New maintainer? #38

We'd love to have a simple Nginx conf maintained as official Piwik nginx conf. Looking for maintainers, Thanks @perusio for your work and hope to hear from you all!

@ttiurani
Copy link

ttiurani commented Oct 20, 2017

In case anyone is interested, I have been successfully using the following nginx.piwik.conf in sites-enabled.

server {
  listen 8006;
  server_name localhost;

  location / {
    index index.php;

    location ~ ^/(.*\.(html|jpg|jpeg|gif|png|css|js|ico|xml|svg|ttf|woff))$ {
      alias /var/www/html/$1;
    }

    location ~ ^/(.*\.php) {
      set $request_url $1;

      fastcgi_param SCRIPT_FILENAME /var/www/html/$request_url;
      fastcgi_param REQUEST_URI /$request_url?$args;
      fastcgi_param HTTPS off;
      fastcgi_pass localhost:9000;
      include fastcgi_params;
      fastcgi_index  index.php;
    }
  }
}

With this kind of forwarding in my main nginx.conf:

  location = /analytics/piwik.php {
    set $request_url piwik.php;
    fastcgi_param SCRIPT_FILENAME /var/www/html/$request_url;
    fastcgi_param REQUEST_URI /$request_url?$args;
    fastcgi_param HTTPS off;
    fastcgi_pass localhost:9000;
    include fastcgi_params;
  }

  location = /analytics/piwik.js {
    alias /var/www/html/piwik.js;
}

Unfortunately I can't be the one who would maintain anything like this: this comes "as it", just in case this could help someone.

@ghost
Copy link

ghost commented Dec 29, 2017

@ttiurani is this working with nginx virtual hosts, ie, multiple sites on the same host with multiple nginx configs? I, too like @anupamapanchal cannot simply blow away other configs for piwik just to ditch google analytics.

@ttiurani
Copy link

ttiurani commented Jan 2, 2018

@clessley yes, the above does work with multiple sites on same host. Don't quite remember the details of everything there unfortunately.

@ghost
Copy link

ghost commented Jan 4, 2018

@ttiurani @mattab

I dumped the most recent piwik install folder into one of my virtual sites' html directories. i then created a database/user and tried the installer; after installing a single required php dependency (which was flagged in the pre-install requirements list) install ran ok. i never used any type of nginx configuration at all as suggested. analytics working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants