nginx + php-fpm "modern configuration way"

locojohn nginx-forum at
Tue Apr 3 21:12:33 UTC 2012

Well, in that case you may as well support SCRIPT_URL / SCRIPT_URI, as
there are some [old] PHP scripts that rely on these variables set
normally by Apache.


http {
  map $uri $script_url {
          ~^(?<script_filename>.+\.(php|html))$ $script_filename;


include fastcgi_params;

          fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
          fastcgi_param SCRIPT_FILENAME
          fastcgi_param PATH_INFO $fastcgi_path_info;
          fastcgi_param PATH_TRANSLATED

          fastcgi_param  SCRIPT_URL $script_url;
          fastcgi_param  SCRIPT_URI $scheme://$http_host$script_url;

          try_files $fastcgi_script_name = 404;

Posted at Nginx Forum:,224829,224900#msg-224900

More information about the nginx mailing list