Skip to content

Instantly share code, notes, and snippets.

@martijngastkemper
Created April 17, 2015 12:08
Show Gist options
  • Save martijngastkemper/c28681ce53df19a5b7ff to your computer and use it in GitHub Desktop.
Save martijngastkemper/c28681ce53df19a5b7ff to your computer and use it in GitHub Desktop.
Use this Nginx configuration to properly run Symfony in production (online) and development (local) environments on Heroku.
location / {
# try to serve file directly, fallback to rewrite
try_files $uri @rewriteapp;
}
location @rewriteapp {
# rewrite all to app.php
rewrite ^(.*)$ /app<?php echo getenv('SYMFONY_ENV') === 'prod' ? '' : '_dev'; ?>.php/$1 last;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
try_files @heroku-fcgi @heroku-fcgi;
internal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment