Ho un server HTTP Nginx con PHP-FPM impostato e quasi tutto funziona bene. Voglio essere in grado di andare in path/to/file
e mi dà index.php?url=path/to/file
, che fa. Tuttavia, scarica il PHP effettivo, non lo eseguirà nel browser. Non sono sicuro di cosa lo stia causando.
Configurazione Nginx:
server { listen 80; server_name sandbox.domain.tld; access_log /path/to/domain/log/sandbox.access.log; error_log /path/to/domain/log/sandbox.error.log; location / { root /path/to/sandbox; index index.php; if (!-e $request_filename) { rewrite ^/beta/(.+)$ /beta/index.php?url=$1 break; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /usr/local/nginx/conf/fastcgi_params; fastcgi_param SCRIPT_FILENAME /path/to/sandbox$fastcgi_script_name; }
Prova a cambiare
rewrite ^/beta/(.+)$ /beta/index.php?url=$1 break;
a
rewrite ^/beta/(.+)$ /beta/index.php?url=$1 last; break;
Quale dovrebbe get nginx per rileggere l'URI ed elaborarlo di conseguenza.