@@ -202,25 +202,30 @@ are:
202202 server_name domain.tld www.domain.tld;
203203 root /var/www/project/web;
204204
205- if ($request_uri ~ "/app\.php(/|$)") {
206- # prevent explicit access and hide front controller
207- # remove this block if you want to allow uri's like
208- # http://domain.tld/app.php/some-path
209- return 404;
210- }
211-
212205 location / {
213206 # try to serve file directly, fallback to app.php
214207 try_files $uri /app.php$is_args$args;
215208 }
216-
217- location ~ ^/(app| app_dev|config)\.php(/|$) {
209+ # DEV
210+ location ~ ^/(app_dev|config)\.php(/|$) {
218211 fastcgi_pass unix:/var/run/php5-fpm.sock;
219212 fastcgi_split_path_info ^(.+\.php)(/.*)$;
220213 include fastcgi_params;
221214 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
222215 fastcgi_param HTTPS off;
223216 }
217+ # PROD
218+ location ~ ^/app\.php(/|$) {
219+ fastcgi_pass unix:/var/run/php5-fpm.sock;
220+ fastcgi_split_path_info ^(.+\.php)(/.*)$;
221+ include fastcgi_params;
222+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
223+ fastcgi_param HTTPS off;
224+ # prevent explicit access and hide front controller
225+ # remove "internal" directive if you want to allow uri's like
226+ # http://domain.tld/app.php/some-path
227+ internal;
228+ }
224229
225230 error_log /var/log/nginx/project_error.log;
226231 access_log /var/log/nginx/project_access.log;
0 commit comments