Skip to content

Commit

Permalink
* Replaced IF statement by "internal" directive.
Browse files Browse the repository at this point in the history
* Splitted config for PROD and DEV environments.
  • Loading branch information
phansys authored and weaverryan committed Nov 4, 2014
1 parent ebf4ea8 commit d1f1b33
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions cookbook/configuration/web_server_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,25 +202,30 @@ are:
server_name domain.tld www.domain.tld;
root /var/www/project/web;
if ($request_uri ~ "/app\.php(/|$)") {
# prevent explicit access and hide front controller
# remove this block if you want to allow uri's like
# http://domain.tld/app.php/some-path
return 404;
}
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
# DEV
location ~ ^/(app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
# prevent explicit access and hide front controller
# remove "internal" directive if you want to allow uri's like
# http://domain.tld/app.php/some-path
internal;
}
error_log /var/log/nginx/project_error.log;
access_log /var/log/nginx/project_access.log;
Expand Down

0 comments on commit d1f1b33

Please sign in to comment.