[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Konfiguration NGinX/PHP



Am Mittwoch, 1. Dezember 2021, 13:34:52 CET schrieb Jan Kohnert:

[...]

>�������� location ~ \.php(/|$) {

>������������ include fastcgi_params;

>������������ fastcgi_split_path_info ^/simplesaml/(.+?\.php)(/.+)$;

>������������ fastcgi_param SCRIPT_FILENAME

> $document_root$fastcgi_script_name; fastcgi_pass

> unix:/run/php/php7.4-fpm.sock;

>������������ fastcgi_index index.php;

>�������� }


Merke: Immer die RegExp genau ansehen und testen. :-D Der RegExp hier matcht nat� nur, wenn nach dem php ein / kommt, was nicht zwingend der Fall ist. Und soweit ich es in der NGinX Doku gesehen habe, sollte das include doch erst nach den Eigendefinitionen kommen


Jedenfalls funktioniert das:

������� location ~ \.php(/|$) {

����������� # Strip out location base in the calculation of script name/parameters

����������� fastcgi_split_path_info ^/simplesaml/(.+\.php)(.*)$;

�����������

����������� # Check the script exists before proxying

����������� if (!-f $document_root/$fastcgi_script_name) {

��������������� return 404;

����������� }

�����������

����������� # Mitigate https://httpoxy.org/ vulnerabilities

����������� fastcgi_param HTTP_PROXY "";

�����������

����������� # Now set the script name and proxy

����������� fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;

����������� fastcgi_pass unix:/run/php/php7.4-fpm.sock;

����������� fastcgi_index index.php;

�����������

����������� # include Debians main configuration

����������� include fastcgi_params;

������� }


--

Mit freundlichen Gr�p>

Jan Kohnert


Reply to: