Giter Site home page Giter Site logo

Comments (3)

simevo avatar simevo commented on June 14, 2024

questo in realtà potrebbe confluire in #10

from spid-cie-php.

simevo avatar simevo commented on June 14, 2024

Rettifica, la configurazione nginx si simplesamlphp è più delicata di altre librerie PHP, ci sono due aspetti:

  1. Lo snippet di configurazione che si usa di solito in nginx su debian 9 (snippets/fastcgi-php.conf, vedi [1]) non va bene, perché è indispensabile cambiare fastcgi_split_path_info, la regex che divide la url in $fastcgi_script_name e $fastcgi_path_info. Invece della regex predefinita fastcgi_split_path_info ^(.+\.php)(/.+)$; bisogna usare fastcgi_split_path_info ^(.+?\.php)(/.+)$.
  2. Bisogna cambiare la regex che cattura le richieste a file con estensione php: invece della regex standard (location ~ \.php$) che è greedy, bisogna usare \.php(/|$).

Se non si attuano ambedue quese modifiche, l'url https://spid.simevo.com/myservice/module.php/saml/sp/metadata.php/service-l1?output=xml che dovrebbe restituire i metadata, invece di matchare il file /srv/spid-php/www/myservice/module.php va a matchare /srv/spid-php/www/myservice/module.php/saml/sp/metadata.php/service-l1 quindi dà un errore 404.

Lo snippet indicato in [2] da questo punto è fuorviante, mentre [3] è più corretto, ma non abbastanza corretto perché bisogna tenere conto che su debian 9 php è versione 7 invece che 5 e che lo snippet per configurare fastgci è fastcgi.conf (che definisce anche SCRIPT_FILENAME) invece di fastcgi_params.

Sezione server corretta:

server {  
  listen 443 ssl http2;  
  server_name spid.simevo.com;  
  root /srv/spid-php/www;
  include snippets/snakeoil.conf;  
  location / {
    try_files $uri $uri/ =404;
    index index.php;
    location ~ \.php$ {
      include snippets/fastcgi-php.conf;  
      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;  
    }
  }
  location /myservice/ {
    index index.php;
    location ~ \.php(/|$) {
      fastcgi_split_path_info ^(.+?\.php)(/.+)$;
      try_files $fastcgi_script_name =404;
      set $path_info $fastcgi_path_info;
      fastcgi_param PATH_INFO $path_info;
      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;  
      fastcgi_index index.php;
      include fastcgi.conf;
    }
  }
  # error_log /var/log/nginx/error_debug.log debug;
}

Riferimenti:
[1] http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_split_path_info
[2] https://simplesamlphp.org/docs/development/simplesamlphp-install#section_7
[3] https://casadelkrogh.dk/2014/09/embedding-simplesamlphp-using-nginx/

from spid-cie-php.

damikael avatar damikael commented on June 14, 2024

Aggiornato README

from spid-cie-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.